aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-06-20 12:45:51 +0100
committerFrancis Irving <francis@mysociety.org>2010-06-20 12:45:51 +0100
commitec5ccf61144f1bbc5861e9511e934a11f93ac4cd (patch)
treeec0739e2b996303a39b7d050bd66948e51938eea /app/models
parentf7b610ebbfa0552b727a41fc092ac9c8c1b7fe3a (diff)
Make edits to outgoing message cause index update.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/outgoing_message.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 0700857d8..40abe0b0f 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -39,6 +39,16 @@ class OutgoingMessage < ActiveRecord::Base
# contact address changed
has_many :info_request_events
+ # reindex if body text is edited (e.g. by admin interface)
+ after_update :xapian_reindex_after_update
+ def xapian_reindex_after_update
+ if self.changes.include?('body')
+ for info_request_event in self.info_request_events
+ info_request_event.xapian_mark_needs_index
+ end
+ end
+ end
+
# How the default letter starts and ends
def get_salutation
ret = "Dear "