diff options
-rw-r--r-- | app/models/public_body.rb | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 23f71333d..f8c12e1e8 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -282,24 +282,11 @@ class PublicBody < ActiveRecord::Base # Guess home page from the request email, or use explicit override, or nil # if not known. def calculated_home_page - # manual override for ones we calculate wrongly - if self.home_page != '' - # Add standard URL prefix - if home_page[0..10] == 'http://www.' - return self.home_page - else - return "http://www.#{self.home_page}" - end + if home_page && !home_page.empty? + home_page[0..10] == 'http://www.' ? home_page : "http://www.#{home_page}" + elsif request_email_domain + "http://www.#{request_email_domain}" end - - # extract the domain name from the FOI request email - url = self.request_email_domain - if url.nil? - return nil - end - - # add standard URL prefix - return "http://www." + url end # Are all requests to this body under the Environmental Information Regulations? |