Read 'Show Unread Count' on ThreadWatcher initialization to avoid semi-broken state when setting is changed.
This commit is contained in:
parent
a05431c07d
commit
808b8661f1
@ -17,6 +17,7 @@ ThreadWatcher =
|
||||
@refreshButton = $ '.refresh', @dialog
|
||||
@closeButton = $('.move > .close', @dialog)
|
||||
@unreaddb = Unread.db or new DataBoard 'lastReadPosts'
|
||||
@unreadEnabled = Conf['Remember Last Read Post']
|
||||
|
||||
$.on d, 'QRPostSuccessful', @cb.post
|
||||
$.on sc, 'click', @toggleWatcher
|
||||
@ -145,7 +146,7 @@ ThreadWatcher =
|
||||
if Conf['Auto Prune'] or not (data and typeof data is 'object') # corrupt data
|
||||
db.delete {boardID, threadID}
|
||||
else
|
||||
if Conf['Remember Last Read Post'] and Conf['Show Unread Count']
|
||||
if ThreadWatcher.unreadEnabled and Conf['Show Unread Count']
|
||||
ThreadWatcher.fetchStatus {boardID, threadID, data}
|
||||
data.isDead = true
|
||||
db.set {boardID, threadID, val: data}
|
||||
@ -174,7 +175,7 @@ ThreadWatcher =
|
||||
clearTimeout ThreadWatcher.timeout
|
||||
return unless Conf['Auto Update Thread Watcher']
|
||||
{db} = ThreadWatcher
|
||||
interval = if Conf['Remember Last Read Post'] and Conf['Show Unread Count'] then 5 * $.MINUTE else 2 * $.HOUR
|
||||
interval = if ThreadWatcher.unreadEnabled and Conf['Show Unread Count'] then 5 * $.MINUTE else 2 * $.HOUR
|
||||
now = Date.now()
|
||||
if now >= (db.data.lastChecked or 0) + interval
|
||||
db.data.lastChecked = now
|
||||
@ -291,7 +292,7 @@ ThreadWatcher =
|
||||
title: data.excerpt
|
||||
className: 'watcher-link'
|
||||
|
||||
if Conf['Remember Last Read Post'] and Conf['Show Unread Count'] and data.unread?
|
||||
if ThreadWatcher.unreadEnabled and Conf['Show Unread Count'] and data.unread?
|
||||
count = $.el 'span',
|
||||
textContent: "(#{data.unread})"
|
||||
className: 'watcher-unread'
|
||||
@ -307,7 +308,7 @@ ThreadWatcher =
|
||||
div.dataset.fullID = fullID
|
||||
$.addClass div, 'current' if g.VIEW is 'thread' and fullID is "#{g.BOARD}.#{g.THREADID}"
|
||||
$.addClass div, 'dead-thread' if data.isDead
|
||||
if Conf['Remember Last Read Post'] and Conf['Show Unread Count']
|
||||
if ThreadWatcher.unreadEnabled and Conf['Show Unread Count']
|
||||
$.addClass div, 'replies-read' if data.unread is 0
|
||||
$.addClass div, 'replies-unread' if data.unread
|
||||
$.addClass div, 'replies-quoting-you' if data.quotingYou
|
||||
@ -397,7 +398,7 @@ ThreadWatcher =
|
||||
data.excerpt = Get.threadExcerpt thread
|
||||
ThreadWatcher.db.set {boardID, threadID, val: data}
|
||||
ThreadWatcher.refresh()
|
||||
if Conf['Remember Last Read Post'] and Conf['Show Unread Count']
|
||||
if ThreadWatcher.unreadEnabled and Conf['Show Unread Count']
|
||||
ThreadWatcher.fetchStatus {boardID, threadID, data}, true
|
||||
|
||||
rm: (boardID, threadID) ->
|
||||
@ -473,7 +474,7 @@ ThreadWatcher =
|
||||
el: UI.checkbox name, name.replace(' Thread Watcher', '')
|
||||
entry.el.title = desc
|
||||
input = entry.el.firstElementChild
|
||||
if name is 'Show Unread Count' and not Conf['Remember Last Read Post']
|
||||
if name is 'Show Unread Count' and not ThreadWatcher.unreadEnabled
|
||||
input.disabled = true
|
||||
$.addClass entry.el, 'disabled'
|
||||
entry.el.title += '\n[Remember Last Read Post is disabled.]'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user