diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-03-30 16:00:02 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-03-30 16:00:02 +0100 |
commit | f24cc98afa25ad6010ae5316eecc15dfdb3fa79b (patch) | |
tree | c32fecb16bb2097da7dfdf90e6915fce0bf1a425 /app/controllers/admin_comment_controller.rb | |
parent | 823e58dc69960c600230b10604a0051359173f85 (diff) | |
parent | 3c0604cf900ad274d8f6ff421d39854ccbf4b6af (diff) |
Merge branch 'release/0.21'0.21.0.0
Conflicts:
locale/cy/app.po
locale/es_NI/app.po
locale/hr/app.po
locale/is_IS/app.po
locale/sr@latin/app.po
Diffstat (limited to 'app/controllers/admin_comment_controller.rb')
-rw-r--r-- | app/controllers/admin_comment_controller.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/controllers/admin_comment_controller.rb b/app/controllers/admin_comment_controller.rb new file mode 100644 index 000000000..0aafb122a --- /dev/null +++ b/app/controllers/admin_comment_controller.rb @@ -0,0 +1,36 @@ +# app/controllers/admin_comment_controller.rb: +# Controller for editing comments from the admin interface. +# +# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ + +class AdminCommentController < AdminController + + def edit + @comment = Comment.find(params[:id]) + end + + def update + @comment = Comment.find(params[:id]) + + old_body = @comment.body + old_visible = @comment.visible + @comment.visible = params[:comment][:visible] == "true" ? true : false + + if @comment.update_attributes(params[:comment]) + @comment.info_request.log_event("edit_comment", + { :comment_id => @comment.id, + :editor => admin_current_user(), + :old_body => old_body, + :body => @comment.body, + :old_visible => old_visible, + :visible => @comment.visible, + }) + flash[:notice] = 'Comment successfully updated.' + redirect_to admin_request_url(@comment.info_request) + else + render :action => 'edit' + end + end + +end |