fix: Custom attr filter on conversations (#5978)

This commit is contained in:
Tejaswini Chile
2022-12-02 10:37:32 +05:30
committed by GitHub
parent e35638588a
commit a08099bbcc
2 changed files with 26 additions and 12 deletions

View File

@@ -86,6 +86,17 @@ describe ::Conversations::FilterService do
expect(result.length).to be conversations.count
end
it 'filter conversations by additional_attributes with NOT_IN filter' do
payload = [{ attribute_key: 'conversation_type', filter_operator: 'not_equal_to', values: 'platinum', query_operator: nil,
custom_attribute_type: 'conversation_attribute' }.with_indifferent_access]
params[:payload] = payload
result = filter_service.new(params, user_1).perform
conversations = Conversation.where(
"custom_attributes ->> 'conversation_type' NOT IN (?) OR custom_attributes ->> 'conversation_type' IS NULL", ['platinum']
)
expect(result[:count][:all_count]).to be conversations.count
end
it 'filter conversations by tags' do
unassigned_conversation.update_labels('support')
params[:payload] = [