Commit 23ef9fed authored by Eric Davis's avatar Eric Davis

[#123] Port the send_notification feature to aaj

parent 216619d3
......@@ -16,10 +16,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class JournalObserver < ActiveRecord::Observer
attr_accessor :send_notification
def after_create(journal)
if journal.type == "IssueJournal" and journal.version > 1
if journal.type == "IssueJournal" and journal.version > 1 and self.send_notification
after_create_issue_journal(journal)
end
clear_notification
end
def after_create_issue_journal(journal)
......@@ -30,4 +33,18 @@ class JournalObserver < ActiveRecord::Observer
Mailer.deliver_issue_edit(journal)
end
end
# Wrap send_notification so it defaults to true, when it's nil
def send_notification
return true if @send_notification.nil?
return @send_notification
end
private
# Need to clear the notification setting after each usage otherwise it might be cached
def clear_notification
@send_notification = true
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment