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
This commit is contained in:
Jean-Philippe Lang
2013-07-14 14:26:27 +00:00
parent 010bfc56e1
commit 205eda8b33
16 changed files with 72 additions and 173 deletions
+7
View File
@@ -98,6 +98,7 @@ class Issue < ActiveRecord::Base
# Should be after_create but would be called before previous after_save callbacks
after_save :after_create_from_copy
after_destroy :update_parent_attributes
after_create :send_notification
# Returns a SQL conditions string used to find all issues visible by the specified user
def self.visible_condition(user, options={})
@@ -1516,6 +1517,12 @@ class Issue < ActiveRecord::Base
end
end
def send_notification
if Setting.notified_events.include?('issue_added')
Mailer.deliver_issue_add(self)
end
end
# Query generator for selecting groups of issue counts for a project
# based on specific criteria
#