feat: Add notification.updated event (#8871)

This commit is contained in:
Muhsin Keloth
2024-02-07 18:15:51 +05:30
committed by GitHub
parent 7776b74126
commit 1b21e0d429
10 changed files with 66 additions and 10 deletions

View File

@@ -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