]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/notes_controller.rb
Allow a comment to be supplied when hiding a note
[rails.git] / app / controllers / notes_controller.rb
index 8a00296555671f7ce4ecb3ff99ca076cbf3c0a69..e79be2e8d31b4605ccaebff60c2a3ca5fa644c42 100644 (file)
@@ -3,8 +3,12 @@ class NotesController < ApplicationController
   layout 'site', :only => [:mine]
 
   before_filter :check_api_readable
-  before_filter :authorize_web, :only => [:create, :comment, :close, :destroy, :mine]
+  before_filter :authorize_web, :only => [:mine]
+  before_filter :setup_user_auth, :only => [:create, :comment]
+  before_filter :authorize, :only => [:close, :destroy]
+  before_filter :require_moderator, :only => [:destroy]
   before_filter :check_api_writable, :only => [:create, :comment, :close, :destroy]
+  before_filter :require_allow_write_notes, :only => [:create, :comment, :close, :destroy]
   before_filter :set_locale, :only => [:mine]
   after_filter :compress_output
   around_filter :api_call_handle_error, :api_call_timeout
@@ -191,6 +195,7 @@ class NotesController < ApplicationController
 
     # Extract the arguments
     id = params[:id].to_i
+    comment = params[:text]
 
     # Find the note and check it is valid
     note = Note.find(id)
@@ -202,7 +207,7 @@ class NotesController < ApplicationController
       note.status = "hidden"
       note.save
 
-      add_comment(note, nil, "hidden")
+      add_comment(note, comment, "hidden")
     end
 
     # Render the result