diff --git a/inc/functions.php b/inc/functions.php index 28ada758..c38baa82 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -1259,6 +1259,8 @@ function deleteFile($id, $remove_entirely_if_already=true, $file=null) { $files = json_decode($post['files']); $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']) return; // Can't delete OP's image completely. diff --git a/js/fix-report-delete-submit.js b/js/fix-report-delete-submit.js index c6122db7..47a04f16 100644 --- a/js/fix-report-delete-submit.js +++ b/js/fix-report-delete-submit.js @@ -11,7 +11,7 @@ if (active_page == 'thread' || active_page == 'index') { $(document).ready(function(){ -if ($('.delete #password').length) { +if ($('#delete-fields #password').length) { Menu.add_item("delete_post_menu", _("Delete post")); Menu.add_item("delete_file_menu", _("Delete file")); Menu.onclick(function(e, $buf) { @@ -53,9 +53,8 @@ Menu.onclick(function(e, $buf) { }); $(document).on('new_post', function(){ - $('div.delete').hide(); $('input.delete').hide(); }); -$('div.delete').hide(); $('input.delete').hide(); +$('#post-moderation-fields').hide(); })}