diff options
-rw-r--r-- | app/controllers/request_controller.rb | 12 | ||||
-rw-r--r-- | app/models/info_request.rb | 15 |
2 files changed, 15 insertions, 12 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 2cabb3cf0..fb78eaac0 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -407,25 +407,13 @@ class RequestController < ApplicationController end # Make the state change - old_described_state = info_request.described_state info_request.set_described_state(params[:incoming_message][:described_state], authenticated_user) # If you're not the *actual* requester. e.g. you are playing the # classification game, or you're doing this just because you are an # admin user (not because you also own the request). if !info_request.is_actual_owning_user?(authenticated_user) - # Log the status change by someone other than the requester - event = info_request.log_event("status_update", - { :user_id => authenticated_user.id, - :old_described_state => old_described_state, - :described_state => info_request.described_state, - }) - # Create a classification event for league tables - RequestClassification.create!(:user_id => authenticated_user.id, - :info_request_event_id => event.id) - # Don't give advice on what to do next, as it isn't their request - RequestMailer.deliver_old_unclassified_updated(info_request) if !info_request.is_external? if session[:request_game] flash[:notice] = _('Thank you for updating the status of the request \'<a href="{{url}}">{{info_request_title}}</a>\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(info_request.title), :url=>CGI.escapeHTML(request_url(info_request))) redirect_to play_url diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 191f10018..237364f56 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -549,6 +549,7 @@ public # change status, including for last event for later historical purposes def set_described_state(new_state, set_by = nil, message = "") + old_described_state = described_state ActiveRecord::Base.transaction do self.awaiting_description = false last_event = self.info_request_events.last @@ -566,6 +567,20 @@ public RequestMailer.deliver_requires_admin(self, set_by, message) end end + + unless set_by.nil? || is_actual_owning_user?(set_by) || described_state == 'attention_requested' + # Log the status change by someone other than the requester + event = log_event("status_update", + { :user_id => set_by.id, + :old_described_state => old_described_state, + :described_state => described_state, + }) + # Create a classification event for league tables + RequestClassification.create!(:user_id => set_by.id, + :info_request_event_id => event.id) + + RequestMailer.deliver_old_unclassified_updated(self) if !is_external? + end end # Work out what the situation of the request is. In addition to values of |