FIX: Publish notification state in `after_commit` hook.
`after_save` is still wrapped in a transaction and we were getting intermittent failures with notifications state not being published.
This commit is contained in:
parent
11dbadb96f
commit
a567e6bec9
|
@ -12,10 +12,8 @@ class Notification < ActiveRecord::Base
|
||||||
scope :visible , lambda { joins('LEFT JOIN topics ON notifications.topic_id = topics.id')
|
scope :visible , lambda { joins('LEFT JOIN topics ON notifications.topic_id = topics.id')
|
||||||
.where('topics.id IS NULL OR topics.deleted_at IS NULL') }
|
.where('topics.id IS NULL OR topics.deleted_at IS NULL') }
|
||||||
|
|
||||||
after_save :refresh_notification_count
|
|
||||||
after_destroy :refresh_notification_count
|
|
||||||
|
|
||||||
after_commit :send_email
|
after_commit :send_email
|
||||||
|
after_commit :refresh_notification_count
|
||||||
|
|
||||||
def self.ensure_consistency!
|
def self.ensure_consistency!
|
||||||
Notification.exec_sql("
|
Notification.exec_sql("
|
||||||
|
|
Loading…
Reference in New Issue