Fix unread count for your posts, among other things

This commit is contained in:
Zixaphir 2014-01-16 11:19:37 -07:00
parent 6095a97921
commit 8135493359
3 changed files with 29 additions and 17 deletions

View File

@ -9955,7 +9955,7 @@
if (!(post.prev || post.next)) { if (!(post.prev || post.next)) {
Unread.posts.push(post); Unread.posts.push(post);
} }
Unread.addPostQuotingYou(post.data); Unread.addPostQuotingYou(post);
} }
if (Conf['Unread Line']) { if (Conf['Unread Line']) {
Unread.setLine((_ref = Unread.posts.first.data, __indexOf.call(posts, _ref) >= 0)); Unread.setLine((_ref = Unread.posts.first.data, __indexOf.call(posts, _ref) >= 0));
@ -10033,20 +10033,24 @@
return arr.splice(0, i); return arr.splice(0, i);
}, },
read: $.debounce(100, function(e) { read: $.debounce(100, function(e) {
var ID, height, post, posts; var ID, data, height, post, posts;
if (d.hidden || !Unread.posts.length) { if (d.hidden || !Unread.posts.length) {
return; return;
} }
height = doc.clientHeight; height = doc.clientHeight;
posts = Unread.posts; posts = Unread.posts;
while (post = posts.first) { while (post = posts.first) {
if (!(Header.getBottomOf(post.data.nodes.root) > -1)) { ID = post.ID, data = post.data;
if (!(Header.getBottomOf(data.nodes.root) > -1)) {
break; break;
} }
ID = post.ID;
posts.rm(ID); posts.rm(ID);
if (Conf['Mark Quotes of You'] && post.info.yours) { if (Conf['Mark Quotes of You'] && QR.db.get({
QuoteYou.lastRead = post.data.nodes.root; boardID: data.board.ID,
threadID: data.thread.ID,
postID: ID
})) {
QuoteYou.lastRead = data.nodes.root;
} }
} }
if (!ID) { if (!ID) {

View File

@ -9938,7 +9938,7 @@
if (!(post.prev || post.next)) { if (!(post.prev || post.next)) {
Unread.posts.push(post); Unread.posts.push(post);
} }
Unread.addPostQuotingYou(post.data); Unread.addPostQuotingYou(post);
} }
if (Conf['Unread Line']) { if (Conf['Unread Line']) {
Unread.setLine((_ref = Unread.posts.first.data, __indexOf.call(posts, _ref) >= 0)); Unread.setLine((_ref = Unread.posts.first.data, __indexOf.call(posts, _ref) >= 0));
@ -10016,20 +10016,24 @@
return arr.splice(0, i); return arr.splice(0, i);
}, },
read: $.debounce(100, function(e) { read: $.debounce(100, function(e) {
var ID, height, post, posts; var ID, data, height, post, posts;
if (d.hidden || !Unread.posts.length) { if (d.hidden || !Unread.posts.length) {
return; return;
} }
height = doc.clientHeight; height = doc.clientHeight;
posts = Unread.posts; posts = Unread.posts;
while (post = posts.first) { while (post = posts.first) {
if (!(Header.getBottomOf(post.data.nodes.root) > -1)) { ID = post.ID, data = post.data;
if (!(Header.getBottomOf(data.nodes.root) > -1)) {
break; break;
} }
ID = post.ID;
posts.rm(ID); posts.rm(ID);
if (Conf['Mark Quotes of You'] && post.info.yours) { if (Conf['Mark Quotes of You'] && QR.db.get({
QuoteYou.lastRead = post.data.nodes.root; boardID: data.board.ID,
threadID: data.thread.ID,
postID: ID
})) {
QuoteYou.lastRead = data.nodes.root;
} }
} }
if (!ID) { if (!ID) {

View File

@ -92,7 +92,7 @@ Unread =
postID: ID postID: ID
} }
Unread.posts.push post unless post.prev or post.next Unread.posts.push post unless post.prev or post.next
Unread.addPostQuotingYou post.data Unread.addPostQuotingYou post
if Conf['Unread Line'] if Conf['Unread Line']
# Force line on visible threads if there were no unread posts previously. # Force line on visible threads if there were no unread posts previously.
Unread.setLine Unread.posts.first.data in posts Unread.setLine Unread.posts.first.data in posts
@ -151,12 +151,16 @@ Unread =
{posts} = Unread {posts} = Unread
while post = posts.first while post = posts.first
break unless Header.getBottomOf(post.data.nodes.root) > -1 # post is not completely read {ID, data} = post
{ID} = post break unless Header.getBottomOf(data.nodes.root) > -1 # post is not completely read
posts.rm ID posts.rm ID
if Conf['Mark Quotes of You'] and post.info.yours if Conf['Mark Quotes of You'] and QR.db.get {
QuoteYou.lastRead = post.data.nodes.root boardID: data.board.ID
threadID: data.thread.ID
postID: ID
}
QuoteYou.lastRead = data.nodes.root
return unless ID return unless ID