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:
@@ -86,9 +86,13 @@ class ConversationFinder
|
||||
@team = current_account.teams.find(params[:team_id]) if params[:team_id]
|
||||
end
|
||||
|
||||
def find_all_conversations
|
||||
def find_conversation_by_inbox
|
||||
@conversations = current_account.conversations
|
||||
@conversations = @conversations.where(inbox_id: @inbox_ids) unless @is_admin
|
||||
@conversations = @conversations.where(inbox_id: @inbox_ids) unless params[:inbox_id].blank? && @is_admin
|
||||
end
|
||||
|
||||
def find_all_conversations
|
||||
find_conversation_by_inbox
|
||||
filter_by_conversation_type if params[:conversation_type]
|
||||
@conversations
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user