diff options
-rw-r--r-- | app/models/request_mailer.rb | 7 | ||||
-rw-r--r-- | app/views/request_mailer/requires_admin.rhtml | 2 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 1 |
3 files changed, 6 insertions, 4 deletions
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index c208923f3..1b0bb48b9 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -47,15 +47,16 @@ class RequestMailer < ApplicationMailer # An FOI response is outside the scope of the system, and needs admin attention def requires_admin(info_request, set_by = nil) if !set_by.nil? - @from = set_by.name_and_email + user = set_by else - @from = info_request.user.name_and_email + user = info_request.user end + @from = user.name_and_email @recipients = contact_from_name_and_email @subject = _("FOI response requires admin ({{reason}}) - {{title}}", :reason => info_request.described_state, :title => info_request.title) url = main_url(request_url(info_request)) admin_url = request_admin_url(info_request) - @body = {:info_request => info_request, :url => url, :admin_url => admin_url } + @body = {:reported_by => user, :info_request => info_request, :url => url, :admin_url => admin_url } end # Tell the requester that a new response has arrived diff --git a/app/views/request_mailer/requires_admin.rhtml b/app/views/request_mailer/requires_admin.rhtml index acd37f405..06a798792 100644 --- a/app/views/request_mailer/requires_admin.rhtml +++ b/app/views/request_mailer/requires_admin.rhtml @@ -1,5 +1,5 @@ --------------------------------------------------------------------- -<%=@info_request.user.name%> <%= _('has reported an')%> <%=@info_request.law_used_short%> +<%=@reported_by.name%> <%= _('has reported an')%> <%=@info_request.law_used_short%> <%= _('response as needing administrator attention. Take a look, and reply to this email to let them know what you are going to do about it.')%> diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 28f56dcf6..13887749d 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -1889,6 +1889,7 @@ describe RequestController, "when reporting a request" do mail = deliveries[0] mail.subject.should =~ /attention_requested/ mail.from.should include(@user.email) + mail.body.should include(@user.name) end end |