fix: Apply filter for inbox when the user is an admin (#11197)
Optimization #11183 missed a condition where the inbox_id filter is manually passed. Due to the previous change, the inbox filter was being discarded for admins, although it continued to work correctly for agents. This PR includes a fix for that specific case and adds a spec to explicitly test it.
This commit is contained in:
@@ -57,6 +57,16 @@ describe ConversationFinder do
|
||||
|
||||
expect(result[:conversations].map(&:id)).not_to include(restricted_conversation.id)
|
||||
end
|
||||
|
||||
it 'returns only the conversations from the inbox if inbox_id filter is passed' do
|
||||
conversation = create(:conversation, account: account, inbox_id: inbox.id)
|
||||
params = { inbox_id: restricted_inbox.id }
|
||||
result = described_class.new(admin, params).perform
|
||||
|
||||
conversation_ids = result[:conversations].map(&:id)
|
||||
expect(conversation_ids).not_to include(conversation.id)
|
||||
expect(conversation_ids).to include(restricted_conversation.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with assignee_type all' do
|
||||
|
||||
Reference in New Issue
Block a user