Fix error where we could have parsed the same post more than once because of multiple request callbacks.

This commit is contained in:
Nicolas Stepien 2012-09-05 03:33:51 +02:00
parent d3efc6347d
commit e0d73a64a7
2 changed files with 24 additions and 11 deletions

View File

@ -1404,8 +1404,12 @@
link.nextSibling.href = "/" + board + "/res/" + threadID + "#q" + postID;
inBoard = g.boards[board] || new Board(board);
inThread = g.threads["" + board + "." + threadID] || new Thread(threadID, inBoard);
post = new Post(pc, inThread, inBoard);
Main.callbackNodes(Post, [post]);
if (!(post = g.posts["" + board + "." + postID])) {
post = new Post(postContainer, thread, board, {
isArchived: true
});
Main.callbackNodes(Post, [post]);
}
if (!root.parentNode) {
return;
}
@ -1482,10 +1486,12 @@
});
board = g.boards[board] || new Board(board);
thread = g.threads["" + board + "." + threadID] || new Thread(threadID, board);
post = new Post(postContainer, thread, board, {
isArchived: true
});
Main.callbackNodes(Post, [post]);
if (!(post = g.posts["" + board + "." + postID])) {
post = new Post(postContainer, thread, board, {
isArchived: true
});
Main.callbackNodes(Post, [post]);
}
if (!root.parentNode) {
return;
}

View File

@ -1194,8 +1194,12 @@ Get =
new Board board
inThread = g.threads["#{board}.#{threadID}"] or
new Thread threadID, inBoard
post = new Post pc, inThread, inBoard
Main.callbackNodes Post, [post]
# In case of multiple callbacks for the same request,
# don't parse the same original post more than once.
unless post = g.posts["#{board}.#{postID}"]
post = new Post postContainer, thread, board,
isArchived: true
Main.callbackNodes Post, [post]
# Stop here if the container has been removed while loading.
return unless root.parentNode
@ -1283,9 +1287,12 @@ Get =
new Board board
thread = g.threads["#{board}.#{threadID}"] or
new Thread threadID, board
post = new Post postContainer, thread, board,
isArchived: true
Main.callbackNodes Post, [post]
# In case of multiple callbacks for the same request,
# don't parse the same original post more than once.
unless post = g.posts["#{board}.#{postID}"]
post = new Post postContainer, thread, board,
isArchived: true
Main.callbackNodes Post, [post]
# Stop here if the container has been removed while loading.
return unless root.parentNode