aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/public_body.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/public_body.rb')
-rw-r--r--app/models/public_body.rb36
1 files changed, 12 insertions, 24 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 232c0ffa1..dac77d4c5 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -339,19 +339,20 @@ class PublicBody < ActiveRecord::Base
# Are all requests to this body under the Environmental Information Regulations?
def eir_only?
- return self.has_tag?('eir_only')
+ has_tag?('eir_only')
end
+
def law_only_short
- if self.eir_only?
- return "EIR"
- else
- return "FOI"
- end
+ eir_only? ? 'EIR' : 'FOI'
end
# Schools are allowed more time in holidays, so we change some wordings
def is_school?
- return self.has_tag?('school')
+ has_tag?('school')
+ end
+
+ def site_administration?
+ has_tag?('site_administration')
end
# The "internal admin" is a special body for internal use.
@@ -379,10 +380,6 @@ class PublicBody < ActiveRecord::Base
end
end
- def site_administration?
- has_tag?('site_administration')
- end
-
class ImportCSVDryRun < StandardError
end
@@ -577,17 +574,11 @@ class PublicBody < ActiveRecord::Base
return self.request_email_domain
end
- # Returns nil if configuration variable not set
- def override_request_email
- e = AlaveteliConfiguration::override_all_public_body_request_emails
- e if e != ""
- end
-
def request_email
- if override_request_email
- override_request_email
- else
+ if AlaveteliConfiguration::override_all_public_body_request_emails.blank? || read_attribute(:request_email).blank?
read_attribute(:request_email)
+ else
+ AlaveteliConfiguration::override_all_public_body_request_emails
end
end
@@ -774,10 +765,7 @@ class PublicBody < ActiveRecord::Base
end
def empty_translation_in_params?(attributes)
- attrs_with_values = attributes.select do |key, value|
- value != '' and key.to_s != 'locale'
- end
- attrs_with_values.empty?
+ attributes.select { |k, v| !v.blank? && k.to_s != 'locale' }.empty?
end
def request_email_if_requestable