Skip to content

Commit

Permalink
Use standard event names
Browse files Browse the repository at this point in the history
  • Loading branch information
mirrec committed Oct 16, 2023
1 parent 99e959c commit afa9143
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/lib/event_bus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def self.reset!
Searchable::ReindexMessageThreadJob.perform_later(message_thread.id)
}

EventBus.subscribe :message_thread_note_committed, ->(note) {
EventBus.subscribe :message_thread_note_created, ->(note) {
Searchable::ReindexMessageThreadJob.perform_later(note.message_thread_id)
}
EventBus.subscribe :message_thread_note_changed, ->(note) {
Searchable::ReindexMessageThreadJob.perform_later(note.message_thread_id)
}

Expand Down
3 changes: 2 additions & 1 deletion app/models/message_thread_note.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class MessageThreadNote < ApplicationRecord
belongs_to :message_thread

after_commit ->(note) { EventBus.publish(:message_thread_note_committed, note) }
after_create_commit ->(note) { EventBus.publish(:message_thread_note_created, note) }
after_update_commit ->(note) { EventBus.publish(:message_thread_note_changed, note) }
end

0 comments on commit afa9143

Please sign in to comment.