fix(search): guard message reindex without searchkick

This commit is contained in:
Sojan Jose
2026-02-02 23:15:37 -08:00
parent dd31bfa572
commit c837dd5cb7
2 changed files with 3 additions and 2 deletions
+2
View File
@@ -421,6 +421,8 @@ class Message < ApplicationRecord
end
def reindex_for_search
return unless respond_to?(:reindex)
reindex(mode: :async)
end
end
+1 -2
View File
@@ -28,8 +28,7 @@ RSpec.describe ContactInbox do
obj.reload
# ensure the column is nil in database
results = ActiveRecord::Base.connection.execute('Select * from contact_inboxes;')
expect(results.first['pubsub_token']).to be_nil
expect(ContactInbox.where(id: obj.id).pick(:pubsub_token)).to be_nil
new_token = obj.pubsub_token
obj.update(source_id: '234234323')