diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-14 14:26:27 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-14 14:26:27 +0000 |
commit | 205eda8b33d69defecedf2d246858a46d3d1d7c0 (patch) | |
tree | 4aeb58588ec0fa06ca385fe032168d336970fe55 /app/models/journal.rb | |
parent | 010bfc56e15f442e4e597ddc9c436361c61b1e7a (diff) | |
download | redmine-205eda8b33d69defecedf2d246858a46d3d1d7c0.tar.gz redmine-205eda8b33d69defecedf2d246858a46d3d1d7c0.zip |
Use AR callbacks instead of observers (removed in Rails4) for notifications.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12021 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/journal.rb')
-rw-r--r-- | app/models/journal.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/journal.rb b/app/models/journal.rb index 47ae12380..2e3aa7f9f 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -39,6 +39,7 @@ class Journal < ActiveRecord::Base " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"} before_create :split_private_notes + after_create :send_notification scope :visible, lambda {|*args| user = args.shift || User.current @@ -165,4 +166,14 @@ class Journal < ActiveRecord::Base end true end + + def send_notification + if notify? && (Setting.notified_events.include?('issue_updated') || + (Setting.notified_events.include?('issue_note_added') && notes.present?) || + (Setting.notified_events.include?('issue_status_updated') && new_status.present?) || + (Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?) + ) + Mailer.deliver_issue_edit(self) + end + end end |