diff --git a/app/lib/event_bus.rb b/app/lib/event_bus.rb index 38a69e317..a05ed2741 100644 --- a/app/lib/event_bus.rb +++ b/app/lib/event_bus.rb @@ -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) } diff --git a/app/models/message_thread_note.rb b/app/models/message_thread_note.rb index d67f74771..cfa9c3a87 100644 --- a/app/models/message_thread_note.rb +++ b/app/models/message_thread_note.rb @@ -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