Fix updating the context of threads and index
This commit is contained in:
parent
7d4825dce0
commit
e7b1c52dbf
@ -2715,19 +2715,20 @@
|
||||
Main.callbackNodes(Post, posts);
|
||||
return $.event('IndexRefresh');
|
||||
},
|
||||
buildReplies: function(threadRoots) {
|
||||
var data, err, errors, i, lastReplies, node, nodes, post, posts, thread, threadRoot, _i, _j, _len, _len1;
|
||||
buildReplies: function(threads) {
|
||||
var errors, posts;
|
||||
posts = [];
|
||||
for (_i = 0, _len = threadRoots.length; _i < _len; _i++) {
|
||||
threadRoot = threadRoots[_i];
|
||||
thread = Get.threadFromRoot(threadRoot);
|
||||
errors = null;
|
||||
threads.forEach(function(thread) {
|
||||
var data, err, i, lastReplies, node, nodes, post, threadRoot, _i, _len;
|
||||
threadRoot = thread.OP.nodes.root.parentElement;
|
||||
i = Index.liveThreadIDs.indexOf(thread.ID);
|
||||
if (!(lastReplies = Index.liveThreadData[i].last_replies)) {
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
nodes = [];
|
||||
for (_j = 0, _len1 = lastReplies.length; _j < _len1; _j++) {
|
||||
data = lastReplies[_j];
|
||||
for (_i = 0, _len = lastReplies.length; _i < _len; _i++) {
|
||||
data = lastReplies[_i];
|
||||
if (post = thread.posts[data.no]) {
|
||||
nodes.push(post.nodes.root);
|
||||
continue;
|
||||
@ -2746,8 +2747,8 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
$.add(threadRoot, nodes);
|
||||
}
|
||||
return $.add(threadRoot, nodes);
|
||||
});
|
||||
if (errors) {
|
||||
Main.handleErrors(errors);
|
||||
}
|
||||
@ -2852,7 +2853,7 @@
|
||||
$.rmAll(Index.root);
|
||||
$.rmAll(Header.hover);
|
||||
if (Conf['Show Replies']) {
|
||||
Index.buildReplies(nodes);
|
||||
Index.buildReplies(g.BOARD.threads);
|
||||
}
|
||||
return Index.buildStructure(nodes);
|
||||
},
|
||||
@ -12293,9 +12294,11 @@
|
||||
pageNum = view;
|
||||
view = 'index';
|
||||
}
|
||||
Navigate.updateContext(view);
|
||||
if (!(view === g.VIEW && boardID === g.BOARD.ID)) {
|
||||
if (view === g.VIEW && boardID === g.BOARD.ID) {
|
||||
Navigate.updateContext(view);
|
||||
} else {
|
||||
Navigate.disconnect();
|
||||
Navigate.updateContext(view);
|
||||
Navigate.clean();
|
||||
Navigate.reconnect();
|
||||
}
|
||||
|
||||
@ -2725,19 +2725,20 @@
|
||||
Main.callbackNodes(Post, posts);
|
||||
return $.event('IndexRefresh');
|
||||
},
|
||||
buildReplies: function(threadRoots) {
|
||||
var data, err, errors, i, lastReplies, node, nodes, post, posts, thread, threadRoot, _i, _j, _len, _len1;
|
||||
buildReplies: function(threads) {
|
||||
var errors, posts;
|
||||
posts = [];
|
||||
for (_i = 0, _len = threadRoots.length; _i < _len; _i++) {
|
||||
threadRoot = threadRoots[_i];
|
||||
thread = Get.threadFromRoot(threadRoot);
|
||||
errors = null;
|
||||
threads.forEach(function(thread) {
|
||||
var data, err, i, lastReplies, node, nodes, post, threadRoot, _i, _len;
|
||||
threadRoot = thread.OP.nodes.root.parentElement;
|
||||
i = Index.liveThreadIDs.indexOf(thread.ID);
|
||||
if (!(lastReplies = Index.liveThreadData[i].last_replies)) {
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
nodes = [];
|
||||
for (_j = 0, _len1 = lastReplies.length; _j < _len1; _j++) {
|
||||
data = lastReplies[_j];
|
||||
for (_i = 0, _len = lastReplies.length; _i < _len; _i++) {
|
||||
data = lastReplies[_i];
|
||||
if (post = thread.posts[data.no]) {
|
||||
nodes.push(post.nodes.root);
|
||||
continue;
|
||||
@ -2756,8 +2757,8 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
$.add(threadRoot, nodes);
|
||||
}
|
||||
return $.add(threadRoot, nodes);
|
||||
});
|
||||
if (errors) {
|
||||
Main.handleErrors(errors);
|
||||
}
|
||||
@ -2862,7 +2863,7 @@
|
||||
$.rmAll(Index.root);
|
||||
$.rmAll(Header.hover);
|
||||
if (Conf['Show Replies']) {
|
||||
Index.buildReplies(nodes);
|
||||
Index.buildReplies(g.BOARD.threads);
|
||||
}
|
||||
return Index.buildStructure(nodes);
|
||||
},
|
||||
@ -12282,9 +12283,11 @@
|
||||
pageNum = view;
|
||||
view = 'index';
|
||||
}
|
||||
Navigate.updateContext(view);
|
||||
if (!(view === g.VIEW && boardID === g.BOARD.ID)) {
|
||||
if (view === g.VIEW && boardID === g.BOARD.ID) {
|
||||
Navigate.updateContext(view);
|
||||
} else {
|
||||
Navigate.disconnect();
|
||||
Navigate.updateContext(view);
|
||||
Navigate.clean();
|
||||
Navigate.reconnect();
|
||||
}
|
||||
|
||||
@ -349,12 +349,13 @@ Index =
|
||||
Main.callbackNodes Post, posts
|
||||
$.event 'IndexRefresh'
|
||||
|
||||
buildReplies: (threadRoots) ->
|
||||
posts = []
|
||||
for threadRoot in threadRoots
|
||||
thread = Get.threadFromRoot threadRoot
|
||||
buildReplies: (threads) ->
|
||||
posts = []
|
||||
errors = null
|
||||
threads.forEach (thread) ->
|
||||
threadRoot = thread.OP.nodes.root.parentElement
|
||||
i = Index.liveThreadIDs.indexOf thread.ID
|
||||
continue unless lastReplies = Index.liveThreadData[i].last_replies
|
||||
return unless lastReplies = Index.liveThreadData[i].last_replies
|
||||
nodes = []
|
||||
for data in lastReplies
|
||||
if post = thread.posts[data.no]
|
||||
@ -436,7 +437,7 @@ Index =
|
||||
nodes.push target.data
|
||||
$.rmAll Index.root
|
||||
$.rmAll Header.hover
|
||||
Index.buildReplies nodes if Conf['Show Replies']
|
||||
Index.buildReplies g.BOARD.threads if Conf['Show Replies']
|
||||
Index.buildStructure nodes
|
||||
|
||||
buildSinglePage: (pageNum) ->
|
||||
|
||||
@ -204,10 +204,11 @@ Navigate =
|
||||
pageNum = view
|
||||
view = 'index' # path is "/boardID/". See the problem?
|
||||
|
||||
Navigate.updateContext view
|
||||
|
||||
unless view is g.VIEW and boardID is g.BOARD.ID # We've navigated somewhere we weren't before!
|
||||
if view is g.VIEW and boardID is g.BOARD.ID
|
||||
Navigate.updateContext view
|
||||
else # We've navigated somewhere we weren't before!
|
||||
Navigate.disconnect()
|
||||
Navigate.updateContext view
|
||||
Navigate.clean()
|
||||
Navigate.reconnect()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user