From 010008eab3a6f3295cfba783f3522af1d52c33a3 Mon Sep 17 00:00:00 2001 From: Toks Date: Tue, 27 Oct 2015 09:49:15 -0400 Subject: [PATCH] Fix being able to delete notes when post is note locked --- app/assets/javascripts/notes.js | 12 +++++++----- app/controllers/notes_controller.rb | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 12765fff4..7dec17f1f 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -523,13 +523,15 @@ Danbooru.Note = { var $this = $(this); var id = $this.data("id"); - Danbooru.Note.Box.find(id).remove(); - Danbooru.Note.Body.find(id).remove(); - $this.dialog("close"); if (id.match(/\d/)) { - $.ajax("/notes/" + id + ".js", { - type: "DELETE" + $.ajax("/notes/" + id + ".json", { + type: "DELETE", + success: function() { + Danbooru.Note.Box.find(id).remove(); + Danbooru.Note.Body.find(id).remove(); + $this.dialog("close"); + } }); } }, diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index f8288d4aa..7c480ef01 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -48,7 +48,7 @@ class NotesController < ApplicationController def destroy @note = Note.find(params[:id]) - @note.update_attribute(:is_active, false) + @note.update_attributes(:is_active => false) respond_with(@note) end