diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/contact_validator.rb | 4 | ||||
-rw-r--r-- | app/models/incoming_message.rb | 4 | ||||
-rw-r--r-- | app/models/info_request.rb | 5 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 4 | ||||
-rw-r--r-- | app/models/outgoing_message.rb | 4 | ||||
-rw-r--r-- | app/models/post_redirect.rb | 4 | ||||
-rw-r--r-- | app/models/public_body.rb | 35 | ||||
-rw-r--r-- | app/models/public_body_tag.rb | 4 | ||||
-rw-r--r-- | app/models/track_thing.rb | 4 | ||||
-rw-r--r-- | app/models/track_things_sent_email.rb | 4 | ||||
-rw-r--r-- | app/models/user.rb | 4 | ||||
-rw-r--r-- | app/models/user_info_request_sent_alert.rb | 4 |
12 files changed, 54 insertions, 26 deletions
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb index f07d643fa..78c30e553 100644 --- a/app/models/contact_validator.rb +++ b/app/models/contact_validator.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: contact_validators # @@ -15,7 +15,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: contact_validator.rb,v 1.16 2008-07-09 07:39:08 francis Exp $ +# $Id: contact_validator.rb,v 1.17 2008-07-16 23:45:41 francis Exp $ class ContactValidator < ActiveRecord::BaseWithoutTable column :name, :string diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 0917d4ac6..385657704 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: incoming_messages # @@ -18,7 +18,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: incoming_message.rb,v 1.119 2008-07-10 13:32:01 francis Exp $ +# $Id: incoming_message.rb,v 1.120 2008-07-16 23:45:41 francis Exp $ # TODO # Move some of the (e.g. quoting) functions here into rblib, as they feel diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 400b3a11e..60e2a15d8 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: info_requests # @@ -14,6 +14,7 @@ # prominence :string(255) default("normal"), not null # url_title :text not null # stop_new_responses :boolean default(false), not null +# law_used :string(255) default("foi"), not null # # models/info_request.rb: @@ -22,7 +23,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.120 2008-07-15 17:24:25 francis Exp $ +# $Id: info_request.rb,v 1.121 2008-07-16 23:45:41 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index dfb930358..a5eb308c6 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: info_request_events # @@ -20,7 +20,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request_event.rb,v 1.46 2008-05-21 10:51:24 francis Exp $ +# $Id: info_request_event.rb,v 1.47 2008-07-16 23:45:41 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 6cc8b2368..74a3f0f6d 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: outgoing_messages # @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: outgoing_message.rb,v 1.54 2008-07-10 08:26:08 francis Exp $ +# $Id: outgoing_message.rb,v 1.55 2008-07-16 23:45:41 francis Exp $ class OutgoingMessage < ActiveRecord::Base belongs_to :info_request diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb index fa00bb8ac..487b5b74d 100644 --- a/app/models/post_redirect.rb +++ b/app/models/post_redirect.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: post_redirects # @@ -26,7 +26,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: post_redirect.rb,v 1.34 2008-06-12 14:17:30 francis Exp $ +# $Id: post_redirect.rb,v 1.35 2008-07-16 23:45:41 francis Exp $ require 'openssl' # for random bytes function diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 39c442710..073304852 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: public_bodies # @@ -13,6 +13,8 @@ # created_at :datetime not null # updated_at :datetime not null # url_name :text not null +# home_page :text default(""), not null +# notes :text default(""), not null # # models/public_body.rb: @@ -21,7 +23,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body.rb,v 1.84 2008-07-10 08:45:46 francis Exp $ +# $Id: public_body.rb,v 1.85 2008-07-16 23:45:41 francis Exp $ require 'csv' require 'set' @@ -109,7 +111,6 @@ class PublicBody < ActiveRecord::Base end end - acts_as_versioned self.non_versioned_columns << 'created_at' << 'updated_at' class Version @@ -202,6 +203,30 @@ class PublicBody < ActiveRecord::Base end end + # Calculate home page, or nil if not known + def calculated_home_page + # manual override for ones we calculate wrongly + if self.home_page != '' + return self.home_page + end + + # extract the domain name + url = self.request_email + url =~ /@(.*)/ + if $1.nil? + return nil + end + url = $1 + + # remove special email domains for UK Government addresses + url.sub!(".gsi.", ".") + url.sub!(".x.", ".") + url.sub!(".pnn.", ".") + + # add standard URL prefix + return "http://www." + url + end + # Are all requests to this body under the Environmental Information Regulations? def eir_only? return self.has_tag?('eir_only') @@ -222,6 +247,8 @@ class PublicBody < ActiveRecord::Base :name => 'Internal admin authority', :short_name => "", :request_email => MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost'), + :home_page => "", + :notes => "", :last_edit_editor => "internal_admin", :last_edit_comment => "Made by PublicBody.internal_admin_body" ) @@ -286,7 +313,7 @@ class PublicBody < ActiveRecord::Base else # New public body notes.push "line " + line.to_s + ": new authority '" + name + "' with email " + email - public_body = PublicBody.new(:name => name, :request_email => email, :short_name => "", :last_edit_editor => editor, :last_edit_comment => 'Created from spreadsheet') + public_body = PublicBody.new(:name => name, :request_email => email, :short_name => "", :home_page => "", :notes => "", :last_edit_editor => editor, :last_edit_comment => 'Created from spreadsheet') public_body.tag_string = tag public_body.save! end diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb index 414b903fb..927ad01f6 100644 --- a/app/models/public_body_tag.rb +++ b/app/models/public_body_tag.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: public_body_tags # @@ -15,7 +15,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body_tag.rb,v 1.13 2008-05-21 10:51:24 francis Exp $ +# $Id: public_body_tag.rb,v 1.14 2008-07-16 23:45:41 francis Exp $ class PublicBodyTag < ActiveRecord::Base validates_presence_of :public_body diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index 3d4e782af..ec7fe271c 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: track_things # @@ -21,7 +21,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_thing.rb,v 1.24 2008-05-27 01:25:09 francis Exp $ +# $Id: track_thing.rb,v 1.25 2008-07-16 23:45:41 francis Exp $ class TrackThing < ActiveRecord::Base belongs_to :tracking_user, :class_name => 'User' diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb index 850f64880..f9fea165a 100644 --- a/app/models/track_things_sent_email.rb +++ b/app/models/track_things_sent_email.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: track_things_sent_emails # @@ -18,7 +18,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_things_sent_email.rb,v 1.7 2008-05-21 10:51:24 francis Exp $ +# $Id: track_things_sent_email.rb,v 1.8 2008-07-16 23:45:41 francis Exp $ class TrackThingsSentEmail < ActiveRecord::Base belongs_to :info_request_event diff --git a/app/models/user.rb b/app/models/user.rb index aa7014a54..5f7f45d04 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: users # @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user.rb,v 1.57 2008-07-08 09:41:04 francis Exp $ +# $Id: user.rb,v 1.58 2008-07-16 23:45:41 francis Exp $ require 'digest/sha1' diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb index e314f541e..e940df2a0 100644 --- a/app/models/user_info_request_sent_alert.rb +++ b/app/models/user_info_request_sent_alert.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 56 +# Schema version: 59 # # Table name: user_info_request_sent_alerts # @@ -17,7 +17,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user_info_request_sent_alert.rb,v 1.17 2008-07-14 12:06:51 francis Exp $ +# $Id: user_info_request_sent_alert.rb,v 1.18 2008-07-16 23:45:41 francis Exp $ class UserInfoRequestSentAlert < ActiveRecord::Base belongs_to :user |