Browse Source

Fixes #3633 - The rebuild of the index is failing.

Rolf Schmidt 3 years ago
parent
commit
5af09d73c7
2 changed files with 8 additions and 3 deletions
  1. 1 1
      app/models/chat/session/search_index.rb
  2. 7 2
      spec/models/chat/session_spec.rb

+ 1 - 1
app/models/chat/session/search_index.rb

@@ -27,7 +27,7 @@ returns
     messages.each do |message|
 
       # lookup attributes of ref. objects (normally name and note)
-      message_attributes = message.search_index_attribute_lookup
+      message_attributes = message.search_index_attribute_lookup(include_references: false)
 
       attributes['messages'].push message_attributes
     end

+ 7 - 2
spec/models/chat/session_spec.rb

@@ -7,11 +7,17 @@ RSpec.describe Chat::Session, type: :model do
   describe '.search_index_attribute_lookup' do
     subject(:chat_session) { create(:'chat/session', user: chat_user, chat: chat) }
 
+    let(:chat_message) { create(:'chat/message', chat_session: chat_session) }
+
     let(:chat) { create(:chat) }
     let(:chat_user) { create(:agent) }
 
+    before do
+      chat_message
+    end
+
     it 'verify message attribute' do
-      expect(chat_session.search_index_attribute_lookup['messages']).to eq []
+      expect(chat_session.search_index_attribute_lookup['messages']).not_to eq []
     end
 
     it 'verify user attribute' do
@@ -21,6 +27,5 @@ RSpec.describe Chat::Session, type: :model do
     it 'verify chat attribute' do
       expect(chat_session.search_index_attribute_lookup['chat']['name']).to eq chat.name
     end
-
   end
 end