1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-11 07:16:10 +01:00

Fix post deletion

This commit is contained in:
8chan 2015-04-20 04:20:17 -07:00
parent b6f0c28234
commit d2168fbe56
2 changed files with 4 additions and 3 deletions

View File

@ -1259,6 +1259,8 @@ function deleteFile($id, $remove_entirely_if_already=true, $file=null) {
$files = json_decode($post['files']); $files = json_decode($post['files']);
$file_to_delete = $file !== false ? $files[(int)$file] : (object)array('file' => false); $file_to_delete = $file !== false ? $files[(int)$file] : (object)array('file' => false);
if (!$files[0]) error(_('That post has no files.'));
if ($files[0]->file == 'deleted' && $post['num_files'] == 1 && !$post['thread']) if ($files[0]->file == 'deleted' && $post['num_files'] == 1 && !$post['thread'])
return; // Can't delete OP's image completely. return; // Can't delete OP's image completely.

View File

@ -11,7 +11,7 @@
if (active_page == 'thread' || active_page == 'index') { if (active_page == 'thread' || active_page == 'index') {
$(document).ready(function(){ $(document).ready(function(){
if ($('.delete #password').length) { if ($('#delete-fields #password').length) {
Menu.add_item("delete_post_menu", _("Delete post")); Menu.add_item("delete_post_menu", _("Delete post"));
Menu.add_item("delete_file_menu", _("Delete file")); Menu.add_item("delete_file_menu", _("Delete file"));
Menu.onclick(function(e, $buf) { Menu.onclick(function(e, $buf) {
@ -53,9 +53,8 @@ Menu.onclick(function(e, $buf) {
}); });
$(document).on('new_post', function(){ $(document).on('new_post', function(){
$('div.delete').hide();
$('input.delete').hide(); $('input.delete').hide();
}); });
$('div.delete').hide();
$('input.delete').hide(); $('input.delete').hide();
$('#post-moderation-fields').hide();
})} })}