2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

UserEmailObserver is now removed

no big surprises here was pretty straightforward

after_commit semantics sure are weird though
This commit is contained in:
Sam 2016-12-22 15:29:34 +11:00
parent 2f6a4cc6de
commit 019f1a1d06
7 changed files with 38 additions and 34 deletions

View file

@ -15,6 +15,8 @@ class Notification < ActiveRecord::Base
after_save :refresh_notification_count
after_destroy :refresh_notification_count
after_commit :send_email
def self.ensure_consistency!
Notification.exec_sql("
DELETE FROM Notifications n WHERE notification_type = :id AND
@ -196,6 +198,11 @@ class Notification < ActiveRecord::Base
user.publish_notifications_state
end
def send_email
transaction_includes_action = self.send(:transaction_include_any_action?, [:create])
NotificationEmailer.process_notification(self) if transaction_includes_action
end
end
# == Schema Information