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

This commit is contained in:
Rolf Schmidt 2021-06-24 13:58:16 +01:00 committed by Thorsten Eckel
parent 548ab91398
commit 5af09d73c7
2 changed files with 8 additions and 3 deletions

View file

@ -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

View file

@ -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