aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/track_mailer.rb6
-rw-r--r--app/views/track_mailer/event_digest.rhtml8
2 files changed, 6 insertions, 8 deletions
diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb
index 713bf3fca..b0dc0f27e 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.9 2008-05-15 17:40:43 francis Exp $
+# $Id: track_mailer.rb,v 1.10 2008-05-16 12:29:38 francis Exp $
class TrackMailer < ApplicationMailer
def event_digest(user, email_about_things)
@@ -57,7 +57,7 @@ class TrackMailer < ApplicationMailer
end
# If there were more alerts for this track, then store them
if alert_results.size > 0
- email_about_things.push([track_thing, alert_results])
+ email_about_things.push([track_thing, alert_results, xapian_object])
end
end
@@ -65,7 +65,7 @@ class TrackMailer < ApplicationMailer
if email_about_things.size > 0
# Debugging
STDERR.puts "sending email alert for user " + user.url_name
- for track_thing, alert_results in email_about_things
+ for track_thing, alert_results, xapian_object in email_about_things
STDERR.puts " tracking " + track_thing.track_query
for result in alert_results.reverse
STDERR.puts " result " + result[:model].class.to_s + " id " + result[:model].id.to_s
diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.rhtml
index 858f94516..f74be2854 100644
--- a/app/views/track_mailer/event_digest.rhtml
+++ b/app/views/track_mailer/event_digest.rhtml
@@ -1,12 +1,10 @@
-<% if @highlight_words.nil?
- @highlight_words = []
- end
-
+<%
# Construct the main text of the mail
main_text = ''
- for track_thing, alert_results in @email_about_things
+ for track_thing, alert_results, xapian_object in @email_about_things
main_text += track_thing.params[:title_in_email] + "\n"
main_text += ("=" * track_thing.params[:title_in_email].size) + "\n\n"
+ @highlight_words = xapian_object.words_to_highlight
for result in alert_results.reverse
if result[:model].class.to_s == "InfoRequestEvent"
event = result[:model]