DEV: Add DiscourseEvent triggers to Invitee creation and update (#683)

* DEV: Add DiscourseEvent triggers to Invitee creation and update

* undid removed code

* remove not longer used file

* change trigger name
This commit is contained in:
Juan David Martínez Cubillos 2025-01-24 12:03:46 -05:00 committed by GitHub
parent e5dee743e1
commit fdf3ad9277
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -22,6 +22,7 @@ module DiscoursePostEvent
Invitee.create!(status: Invitee.statuses[status.to_sym], post_id: post_id, user_id: user_id) Invitee.create!(status: Invitee.statuses[status.to_sym], post_id: post_id, user_id: user_id)
invitee.event.publish_update! invitee.event.publish_update!
invitee.update_topic_tracking! invitee.update_topic_tracking!
DiscourseEvent.trigger(:discourse_calendar_post_event_invitee_status_changed, invitee)
invitee invitee
rescue ActiveRecord::RecordNotUnique rescue ActiveRecord::RecordNotUnique
# do nothing in case multiple new attendances would be created very fast # do nothing in case multiple new attendances would be created very fast
@ -34,6 +35,7 @@ module DiscoursePostEvent
self.update(status: new_status) self.update(status: new_status)
self.event.publish_update! self.event.publish_update!
self.update_topic_tracking! if status_changed self.update_topic_tracking! if status_changed
DiscourseEvent.trigger(:discourse_calendar_post_event_invitee_status_changed, self)
self self
end end