Resurrect posts in case of false-positives. #932
This commit is contained in:
parent
ae970c678a
commit
968cb9744b
@ -5748,11 +5748,10 @@
|
|||||||
_ref = ThreadUpdater.thread.posts;
|
_ref = ThreadUpdater.thread.posts;
|
||||||
for (ID in _ref) {
|
for (ID in _ref) {
|
||||||
post = _ref[ID];
|
post = _ref[ID];
|
||||||
if (post.isDead) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ID = +ID;
|
ID = +ID;
|
||||||
if (__indexOf.call(index, ID) < 0) {
|
if (post.isDead && __indexOf.call(index, ID) >= 0) {
|
||||||
|
post.resurrect();
|
||||||
|
} else if (__indexOf.call(index, ID) < 0) {
|
||||||
post.kill();
|
post.kill();
|
||||||
deletedPosts.push(post);
|
deletedPosts.push(post);
|
||||||
} else if (post.file && !post.file.isDead && __indexOf.call(files, ID) < 0) {
|
} else if (post.file && !post.file.isDead && __indexOf.call(files, ID) < 0) {
|
||||||
@ -7345,6 +7344,28 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Post.prototype.resurrect = function() {
|
||||||
|
var clone, strong, _i, _len, _ref, _results;
|
||||||
|
delete this.isDead;
|
||||||
|
delete this.timeOfDeath;
|
||||||
|
$.rmClass(this.nodes.root, 'deleted-post');
|
||||||
|
strong = $('strong.warning', this.nodes.info);
|
||||||
|
if (this.file && this.file.isDead) {
|
||||||
|
strong.textContent = '[File deleted]';
|
||||||
|
} else {
|
||||||
|
$.rm(strong);
|
||||||
|
}
|
||||||
|
if (this.isClone) {
|
||||||
|
_ref = this.clones;
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
clone = _ref[_i];
|
||||||
|
_results.push(clone.resurrect());
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Post.prototype.addClone = function(context) {
|
Post.prototype.addClone = function(context) {
|
||||||
return new Clone(this, context);
|
return new Clone(this, context);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3941,9 +3941,13 @@ ThreadUpdater =
|
|||||||
deletedFiles = []
|
deletedFiles = []
|
||||||
# Check for deleted posts/files.
|
# Check for deleted posts/files.
|
||||||
for ID, post of ThreadUpdater.thread.posts
|
for ID, post of ThreadUpdater.thread.posts
|
||||||
continue if post.isDead
|
# XXX tmp fix for 4chan's racing condition
|
||||||
|
# giving us false-positive dead posts.
|
||||||
|
# continue if post.isDead
|
||||||
ID = +ID
|
ID = +ID
|
||||||
unless ID in index
|
if post.isDead and ID in index
|
||||||
|
post.resurrect()
|
||||||
|
else unless ID in index
|
||||||
post.kill()
|
post.kill()
|
||||||
deletedPosts.push post
|
deletedPosts.push post
|
||||||
else if post.file and !post.file.isDead and ID not in files
|
else if post.file and !post.file.isDead and ID not in files
|
||||||
|
|||||||
@ -185,6 +185,22 @@ class Post
|
|||||||
$.add quotelink, $.tn '\u00A0(Dead)'
|
$.add quotelink, $.tn '\u00A0(Dead)'
|
||||||
$.addClass quotelink, 'deadlink'
|
$.addClass quotelink, 'deadlink'
|
||||||
return
|
return
|
||||||
|
# XXX tmp fix for 4chan's racing condition
|
||||||
|
# giving us false-positive dead posts.
|
||||||
|
resurrect: ->
|
||||||
|
delete @isDead
|
||||||
|
delete @timeOfDeath
|
||||||
|
$.rmClass @nodes.root, 'deleted-post'
|
||||||
|
strong = $ 'strong.warning', @nodes.info
|
||||||
|
# no false-positive files
|
||||||
|
if @file and @file.isDead
|
||||||
|
strong.textContent = '[File deleted]'
|
||||||
|
else
|
||||||
|
$.rm strong
|
||||||
|
return if @isClone
|
||||||
|
for clone in @clones
|
||||||
|
clone.resurrect()
|
||||||
|
return
|
||||||
addClone: (context) ->
|
addClone: (context) ->
|
||||||
new Clone @, context
|
new Clone @, context
|
||||||
rmClone: (index) ->
|
rmClone: (index) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user