Add siteID parameter to ThreadWatcher.update
This commit is contained in:
parent
9ab1c94e31
commit
86909be300
@ -468,18 +468,16 @@ ThreadWatcher =
|
|||||||
ThreadWatcher.shortcut.classList.toggle className, !!$(".#{className}", ThreadWatcher.dialog)
|
ThreadWatcher.shortcut.classList.toggle className, !!$(".#{className}", ThreadWatcher.dialog)
|
||||||
return
|
return
|
||||||
|
|
||||||
update: (boardID, threadID, newData) ->
|
update: (siteID, boardID, threadID, newData) ->
|
||||||
siteID = Site.hostname
|
return if not (data = ThreadWatcher.db?.get {siteID, boardID, threadID})
|
||||||
return if not (data = ThreadWatcher.db?.get {boardID, threadID})
|
|
||||||
if newData.isDead and Conf['Auto Prune']
|
if newData.isDead and Conf['Auto Prune']
|
||||||
ThreadWatcher.db.delete {boardID, threadID}
|
ThreadWatcher.db.delete {siteID, boardID, threadID}
|
||||||
ThreadWatcher.refresh()
|
ThreadWatcher.refresh()
|
||||||
return
|
return
|
||||||
n = 0
|
n = 0
|
||||||
n++ for key, val of newData when data[key] isnt val
|
n++ for key, val of newData when data[key] isnt val
|
||||||
return unless n
|
return unless n
|
||||||
return if not (data = ThreadWatcher.db.get {boardID, threadID})
|
ThreadWatcher.db.extend {siteID, boardID, threadID, val: newData}
|
||||||
ThreadWatcher.db.extend {boardID, threadID, val: newData}
|
|
||||||
if line = $ "#watched-threads > [data-site-i-d='#{siteID}'][data-full-i-d='#{boardID}.#{threadID}']", ThreadWatcher.dialog
|
if line = $ "#watched-threads > [data-site-i-d='#{siteID}'][data-full-i-d='#{boardID}.#{threadID}']", ThreadWatcher.dialog
|
||||||
newLine = ThreadWatcher.makeLine siteID, boardID, threadID, data
|
newLine = ThreadWatcher.makeLine siteID, boardID, threadID, data
|
||||||
$.replace line, newLine
|
$.replace line, newLine
|
||||||
|
|||||||
@ -238,7 +238,7 @@ Unread =
|
|||||||
saveThreadWatcherCount: $.debounce 2 * $.SECOND, ->
|
saveThreadWatcherCount: $.debounce 2 * $.SECOND, ->
|
||||||
$.forceSync 'Remember Last Read Post'
|
$.forceSync 'Remember Last Read Post'
|
||||||
if Conf['Remember Last Read Post'] and (!Unread.thread.isDead or Unread.thread.isArchived)
|
if Conf['Remember Last Read Post'] and (!Unread.thread.isDead or Unread.thread.isArchived)
|
||||||
ThreadWatcher.update Unread.thread.board.ID, Unread.thread.ID,
|
ThreadWatcher.update Site.hostname, Unread.thread.board.ID, Unread.thread.ID,
|
||||||
isDead: Unread.thread.isDead
|
isDead: Unread.thread.isDead
|
||||||
unread: Unread.posts.size
|
unread: Unread.posts.size
|
||||||
quotingYou: !!(if !Conf['Require OP Quote Link'] and QuoteYou.isYou(Unread.thread.OP) then Unread.posts.size else Unread.postsQuotingYou.size)
|
quotingYou: !!(if !Conf['Require OP Quote Link'] and QuoteYou.isYou(Unread.thread.OP) then Unread.posts.size else Unread.postsQuotingYou.size)
|
||||||
|
|||||||
@ -105,6 +105,6 @@ UnreadIndex =
|
|||||||
val: lastPost
|
val: lastPost
|
||||||
$.rm UnreadIndex.hr[thread.fullID]
|
$.rm UnreadIndex.hr[thread.fullID]
|
||||||
thread.nodes.root.classList.remove 'unread-thread'
|
thread.nodes.root.classList.remove 'unread-thread'
|
||||||
ThreadWatcher.update thread.board.ID, thread.ID,
|
ThreadWatcher.update Site.hostname, thread.board.ID, thread.ID,
|
||||||
unread: 0
|
unread: 0
|
||||||
quotingYou: false
|
quotingYou: false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user