aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/info_request.rb4
-rw-r--r--app/models/request_mailer.rb11
-rw-r--r--app/models/track_thing.rb4
-rw-r--r--app/models/user.rb7
4 files changed, 16 insertions, 10 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index cf82bd854..d09acbcf6 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -553,7 +553,7 @@ public
end
# change status, including for last event for later historical purposes
- def set_described_state(new_state)
+ def set_described_state(new_state, set_by = nil)
ActiveRecord::Base.transaction do
self.awaiting_description = false
last_event = self.get_last_event
@@ -566,7 +566,7 @@ public
self.calculate_event_states
if self.requires_admin?
- RequestMailer.deliver_requires_admin(self)
+ RequestMailer.deliver_requires_admin(self, set_by)
end
end
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index 5ea5df802..03d26f237 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -60,13 +60,18 @@ class RequestMailer < ApplicationMailer
end
# An FOI response is outside the scope of the system, and needs admin attention
- def requires_admin(info_request)
- @from = info_request.user.name_and_email
+ def requires_admin(info_request, set_by = nil)
+ if !set_by.nil?
+ user = set_by
+ else
+ 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/models/track_thing.rb b/app/models/track_thing.rb
index 7f6bc9a7e..d0fc62e12 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -218,8 +218,8 @@ class TrackThing < ActiveRecord::Base
:title_in_email => _("New Freedom of Information requests"),
:title_in_rss => _("New Freedom of Information requests"),
# Authentication
- :web => _("To be follow new requests"),
- :email => _("Then you will be following all new FOI request."),
+ :web => _("To follow new requests"),
+ :email => _("Then you will be following all new FOI requests."),
:email_subject => _("Confirm you want to follow new requests"),
# RSS sorting
:feed_sortby => 'newest'
diff --git a/app/models/user.rb b/app/models/user.rb
index 57fce429c..a21676f68 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -409,7 +409,7 @@ class User < ActiveRecord::Base
columns = self.class.content_columns.map{|c| c if %w(created_at updated_at admin_level email_confirmed).include?(c.name) }.compact
end
columns.each do |column|
- yield(column.human_name, self.send(column.name), column.type.to_s)
+ yield(column.human_name, self.send(column.name), column.type.to_s, column.name)
end
end
@@ -438,8 +438,9 @@ class User < ActiveRecord::Base
after_save(:purge_in_cache)
def purge_in_cache
- # XXX should only be if specific attributes have changed
- self.info_requests.each {|x| x.purge_in_cache}
+ if self.name_changed?
+ self.info_requests.each {|x| x.purge_in_cache}
+ end
end
end