mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
fix: Resolve name only if assignee exists during unassignment (#1649)
This commit is contained in:
@@ -29,5 +29,25 @@ RSpec.describe 'Conversation Assignment API', type: :request do
|
||||
expect(conversation.reload.assignee).to eq(agent)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when conversation already has an assignee' do
|
||||
let(:agent) { create(:user, account: account, role: :agent) }
|
||||
|
||||
before do
|
||||
conversation.update!(assignee: agent)
|
||||
end
|
||||
|
||||
it 'unassigns a user from the conversation' do
|
||||
params = { assignee_id: 0 }
|
||||
post api_v1_account_conversation_assignments_url(account_id: account.id, conversation_id: conversation.display_id),
|
||||
params: params,
|
||||
headers: agent.create_new_auth_token,
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(conversation.reload.assignee).to eq(nil)
|
||||
expect(conversation.messages.last.content).to eq("Conversation unassigned by #{agent.name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user