aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin_request_controller.rb14
-rw-r--r--app/models/info_request_event.rb15
2 files changed, 23 insertions, 6 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index a9cc54c89..ae051add2 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -192,23 +192,37 @@ class AdminRequestController < AdminController
def move_request
info_request = InfoRequest.find(params[:info_request_id])
if params[:commit] == 'Move request to user' && !params[:user_url_name].blank?
+ old_user = info_request.user
destination_user = User.find_by_url_name(params[:user_url_name])
if destination_user.nil?
flash[:error] = "Couldn't find user '" + params[:user_url_name] + "'"
else
info_request.user = destination_user
info_request.save!
+ info_request.log_event("move_request", {
+ :editor => admin_http_auth_user(),
+ :old_user_url_name => old_user.url_name,
+ :new_user_url_name => destination_user.url_name
+ })
+
info_request.reindex_request_events
flash[:notice] = "Message has been moved to new user"
end
redirect_to request_admin_url(info_request)
elsif params[:commit] == 'Move request to authority' && !params[:public_body_url_name].blank?
+ old_public_body = info_request.public_body
destination_public_body = PublicBody.find_by_url_name(params[:public_body_url_name])
if destination_public_body.nil?
flash[:error] = "Couldn't find public body '" + params[:public_body_url_name] + "'"
else
info_request.public_body = destination_public_body
info_request.save!
+ info_request.log_event("move_request", {
+ :editor => admin_http_auth_user(),
+ :old_public_body_url_name => old_public_body.url_name,
+ :new_public_body_url_name => destination_public_body.url_name
+ })
+
info_request.reindex_request_events
flash[:notice] = "Request has been moved to new body"
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 2ffd7df00..b666b3cf2 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -41,13 +41,16 @@ class InfoRequestEvent < ActiveRecord::Base
'resent',
'followup_sent',
'followup_resent',
- 'edit', # title etc. edited in admin interface
- 'edit_outgoing', # outgoing message edited in admin interface
- 'edit_comment', # comment edited in admin interface
- 'destroy_incoming', # deleted an incoming message
- 'destroy_outgoing', # deleted an outgoing message
- 'redeliver_incoming', # redelivered an incoming message elsewhere
+
+ 'edit', # title etc. edited (in admin interface)
+ 'edit_outgoing', # outgoing message edited (in admin interface)
+ 'edit_comment', # comment edited (in admin interface)
+ 'destroy_incoming', # deleted an incoming message (in admin interface)
+ 'destroy_outgoing', # deleted an outgoing message (in admin interface)
+ 'redeliver_incoming', # redelivered an incoming message elsewhere (in admin interface)
+ 'move_request', # changed user or public body (in admin interface)
'manual', # you did something in the db by hand
+
'response',
'comment',
'status_update'