aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/track_mailer.rb13
-rw-r--r--app/models/track_thing.rb6
2 files changed, 11 insertions, 8 deletions
diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb
index 20ca104a1..119654009 100644
--- a/app/models/track_mailer.rb
+++ b/app/models/track_mailer.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_mailer.rb,v 1.4 2008-04-04 14:50:51 francis Exp $
+# $Id: track_mailer.rb,v 1.5 2008-04-09 01:32:53 francis Exp $
class TrackMailer < ApplicationMailer
def event_digest(user, email_about_things)
@@ -28,7 +28,7 @@ class TrackMailer < ApplicationMailer
#STDERR.puts "user " + user.url_name
email_about_things = []
- track_things = TrackThing.find(:all, :conditions => [ "tracking_user_id = ?", user.id ])
+ track_things = TrackThing.find(:all, :conditions => [ "tracking_user_id = ? and track_medium = ?", user.id, 'email_daily' ])
for track_thing in track_things
#STDERR.puts " track " + track_thing.track_query
@@ -41,16 +41,17 @@ class TrackMailer < ApplicationMailer
end
# Query for things in this track
- # XXX remember to update in controllers/application.rb also
+ # XXX remove duplication with controllers/application.rb
+ #perform_search(track_thing.track_query, 'newest', 100, 1, false)
solr_object = InfoRequestEvent.multi_solr_search(track_thing.track_query, :models => [ PublicBody, User ],
- :limit => 100, :offset => 0,
+ :limit => 100, :offset => 0,
:highlight => {
- :prefix => '*', :suffix => '*',
+ :prefix => "*", :suffix => "*",
:fragsize => 250,
:fields => ["solr_text_main", "title", # InfoRequestEvent
"name", "short_name", # PublicBody
"name" # User
- ]}, :order => "created_at desc"
+ ]}, :order => 'created_at desc'
)
# Go through looking for unalerted things
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index 778252c53..2ee494b9d 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -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.7 2008-04-04 02:29:09 francis Exp $
+# $Id: track_thing.rb,v 1.8 2008-04-09 01:32:53 francis Exp $
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
@@ -40,6 +40,7 @@ class TrackThing < ActiveRecord::Base
validates_inclusion_of :track_medium, :in => [
'email_daily',
+ 'feed'
]
def TrackThing.create_track_for_request(info_request)
@@ -57,10 +58,11 @@ class TrackThing < ActiveRecord::Base
if self.track_type == 'request_updates'
@params = {
# Website
- :title => "Track the request '" + CGI.escapeHTML(self.info_request.title) + "'",
+ :set_title => "How would you like to track the request '" + CGI.escapeHTML(self.info_request.title) + "'?",
:list_description => "'<a href=\"/request/" + CGI.escapeHTML(self.info_request.url_title) + "\">" + CGI.escapeHTML(self.info_request.title) + "</a>', a request", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how
# Email
:title_in_email => "New updates for the request '" + self.info_request.title + "'",
+ :title_in_rss => "New updates for the request '" + CGI.escapeHTML(self.info_request.title) + "'",
# Authentication
:web => "To follow updates to the request '" + CGI.escapeHTML(self.info_request.title) + "'",
:email => "Then you will be emailed whenever the request '" + CGI.escapeHTML(self.info_request.title) + "' is updated.",