feat: Add notification.updated event (#8871)
This commit is contained in:
@@ -46,6 +46,7 @@ class Notification < ApplicationRecord
|
||||
before_create :set_last_activity_at
|
||||
after_create_commit :process_notification_delivery, :dispatch_create_event
|
||||
after_destroy_commit :dispatch_destroy_event
|
||||
after_update_commit :dispatch_update_event
|
||||
|
||||
PRIMARY_ACTORS = ['Conversation'].freeze
|
||||
|
||||
@@ -75,7 +76,8 @@ class Notification < ApplicationRecord
|
||||
def primary_actor_data
|
||||
{
|
||||
id: primary_actor.push_event_data[:id],
|
||||
meta: primary_actor.push_event_data[:meta]
|
||||
meta: primary_actor.push_event_data[:meta],
|
||||
inbox_id: primary_actor.push_event_data[:inbox_id]
|
||||
}
|
||||
end
|
||||
|
||||
@@ -142,6 +144,10 @@ class Notification < ApplicationRecord
|
||||
Rails.configuration.dispatcher.dispatch(NOTIFICATION_CREATED, Time.zone.now, notification: self)
|
||||
end
|
||||
|
||||
def dispatch_update_event
|
||||
Rails.configuration.dispatcher.dispatch(NOTIFICATION_UPDATED, Time.zone.now, notification: self)
|
||||
end
|
||||
|
||||
def dispatch_destroy_event
|
||||
Rails.configuration.dispatcher.dispatch(NOTIFICATION_DELETED, Time.zone.now, notification: self)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user