diff options
author | Stan Hu <stanhu@gmail.com> | 2015-03-03 02:05:23 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-03-03 02:26:00 +0300 |
commit | b8c9257fb1dc70cd65a14cb7dec62455ea54e394 (patch) | |
tree | 00c98ff78e7629240c9fa512325ecb0ad1845180 /app/controllers/projects/notes_controller.rb | |
parent | f84bd771d4daa5753ad6a4b7e1a0c3cc9f51d33f (diff) |
Fix bug where editing a comment with "+1" or "-1" would cause a server error
Closes #1151
Diffstat (limited to 'app/controllers/projects/notes_controller.rb')
-rw-r--r-- | app/controllers/projects/notes_controller.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 2f1d631c14a..868629a0bc4 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -3,10 +3,10 @@ class Projects::NotesController < Projects::ApplicationController before_filter :authorize_read_note! before_filter :authorize_write_note!, only: [:create] before_filter :authorize_admin_note!, only: [:update, :destroy] + before_filter :find_current_user_notes, except: [:destroy, :delete_attachment] def index current_fetched_at = Time.now.to_i - @notes = NotesFinder.new.execute(project, current_user, params) notes_json = { notes: [], last_fetched_at: current_fetched_at } @@ -116,4 +116,10 @@ class Projects::NotesController < Projects::ApplicationController :attachment, :line_code, :commit_id ) end + + private + + def find_current_user_notes + @notes = NotesFinder.new.execute(project, current_user, params) + end end |