Display [Deleted] or [File deleted] when we catch deleted posts/files. Close #915.

This commit is contained in:
Nicolas Stepien 2013-02-15 23:30:12 +01:00
parent c5b2539bc0
commit 9136d7f643
2 changed files with 24 additions and 10 deletions

View File

@ -5286,11 +5286,15 @@
}
Post.prototype.kill = function(img) {
var now, quotelink, _i, _len, _ref;
now = Date.now();
var now, quotelink, strong, _i, _len, _ref;
now = new Date();
if (this.file && !this.file.isDead) {
this.file.isDead = true;
this.file.timeOfDeath = now;
$.after($('input', this.nodes.info), $.el('strong', {
className: 'warning',
textContent: '[File deleted]'
}));
}
if (img) {
return;
@ -5298,6 +5302,14 @@
this.isDead = true;
this.timeOfDeath = now;
$.addClass(this.nodes.root, 'dead');
if (strong = $('strong.warning', this.nodes.info)) {
strong.textContent = '[Deleted]';
} else {
$.after($('input', this.nodes.info), $.el('strong', {
className: 'warning',
textContent: '[Deleted]'
}));
}
_ref = Get.allQuotelinksLinkingTo(this);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i];

View File

@ -16,12 +16,6 @@ class Thread
@fullID = "#{@board}.#{@ID}"
@posts = {}
# XXX Can't check when parsing single posts
# move to Post constructor? unless @isReply
# postInfo = $ '.postInfo', root.firstElementChild
# @isClosed = !!$ 'img[title=Closed]', postInfo
# @isSticky = !!$ 'img[title=Sticky]', postInfo
g.threads["#{board}.#{@}"] = board.threads[@] = @
kill: ->
@ -152,15 +146,23 @@ class Post
@kill() if that.isArchived
kill: (img) ->
now = Date.now()
now = new Date()
if @file and !@file.isDead
@file.isDead = true
@file.timeOfDeath = now
$.after $('input', @nodes.info), $.el 'strong',
className: 'warning'
textContent: '[File deleted]'
return if img
@isDead = true
@timeOfDeath = now
$.addClass @nodes.root, 'dead'
# XXX style dead posts.
if strong = $ 'strong.warning', @nodes.info
strong.textContent = '[Deleted]'
else
$.after $('input', @nodes.info), $.el 'strong',
className: 'warning'
textContent: '[Deleted]'
# Get quotelinks/backlinks to this post
# and paint them (Dead).