Fix delete link killing the post instead of the file only when deleting the file.

This commit is contained in:
Nicolas Stepien 2013-04-13 20:11:43 +02:00
parent 7f949af905
commit 552ab4c3a9

View File

@ -1636,20 +1636,22 @@ DeleteLink =
else else
$.id('delPassword').value $.id('delPassword').value
fileOnly = $.hasClass @, 'delete-file'
form = form =
mode: 'usrdel' mode: 'usrdel'
onlyimgdel: $.hasClass @, 'delete-file' onlyimgdel: fileOnly
pwd: pwd pwd: pwd
form[post.ID] = 'delete' form[post.ID] = 'delete'
link = @ link = @
$.ajax $.id('delform').action.replace("/#{g.BOARD}/", "/#{post.board}/"), $.ajax $.id('delform').action.replace("/#{g.BOARD}/", "/#{post.board}/"),
onload: -> DeleteLink.load link, post, @response onload: -> DeleteLink.load link, post, fileOnly, @response
onerror: -> DeleteLink.error link onerror: -> DeleteLink.error link
, ,
cred: true cred: true
form: $.formData form form: $.formData form
load: (link, post, html) -> load: (link, post, fileOnly, html) ->
tmpDoc = d.implementation.createHTMLDocument '' tmpDoc = d.implementation.createHTMLDocument ''
tmpDoc.documentElement.innerHTML = html tmpDoc.documentElement.innerHTML = html
if tmpDoc.title is '4chan - Banned' # Ban/warn check if tmpDoc.title is '4chan - Banned' # Ban/warn check
@ -1660,7 +1662,7 @@ DeleteLink =
else else
if tmpDoc.title is 'Updating index...' if tmpDoc.title is 'Updating index...'
# We're 100% sure. # We're 100% sure.
(post.origin or post).kill() (post.origin or post).kill fileOnly
s = 'Deleted' s = 'Deleted'
link.textContent = s link.textContent = s
error: (link) -> error: (link) ->