From 9c188ff0cb867893d988d7776c7a75d99b864da0 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 30 Oct 2016 20:18:40 -0500 Subject: [PATCH 1/2] Fix notes appearing unsaved after saving them. Bug: creating a note then saving it doesn't remove the red border indicating it's unsaved. Broken by 8df1496 / PR #2729. Ref: http://danbooru.donmai.us/forum_topics/13348. --- app/controllers/notes_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index e14060826..188527ad1 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -65,7 +65,7 @@ private end def create_params - params.require(:note).permit(:x, :y, :width, :height, :body, :post_id) + params.require(:note).permit(:x, :y, :width, :height, :body, :post_id, :html_id) end def pass_html_id From 00da01ea3ef33c6d76da45ce6902807c96b0c6ea Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 31 Oct 2016 01:37:49 +0000 Subject: [PATCH 2/2] Remove unused NotesController#pass_html_id. Dead code as far as I can tell. According to `git log -p -G "X-Html-Id"` was added in 2011 and never used. HTML id is passed to javascript in the JSON response to `POST /notes.json` instead. --- app/controllers/notes_controller.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 188527ad1..6cb207108 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -1,7 +1,6 @@ class NotesController < ApplicationController respond_to :html, :xml, :json, :js before_filter :member_only, :except => [:index, :show] - before_filter :pass_html_id, :only => [:create] def search end @@ -68,12 +67,6 @@ private params.require(:note).permit(:x, :y, :width, :height, :body, :post_id, :html_id) end - def pass_html_id - if params[:note] && params[:note][:html_id] - response.headers["X-Html-Id"] = params[:note][:html_id] - end - end - def index_by_post @post_set = PostSets::Note.new(params) @posts = @post_set.posts