Feature: Ability to mute contacts (#891)

fixes: #867
This commit is contained in:
Abdulkadir Poyraz
2020-05-26 15:13:59 +03:00
committed by GitHub
parent d8d14fc4a4
commit b1aab228ae
16 changed files with 148 additions and 2 deletions

View File

@@ -177,4 +177,30 @@ RSpec.describe 'Conversations API', type: :request do
end
end
end
describe 'POST /api/v1/accounts/{account.id}/conversations/:id/mute' do
let(:conversation) { create(:conversation, account: account) }
context 'when it is an unauthenticated user' do
it 'returns unauthorized' do
post "/api/v1/accounts/#{account.id}/conversations/#{conversation.display_id}/mute"
expect(response).to have_http_status(:unauthorized)
end
end
context 'when it is an authenticated user' do
let(:agent) { create(:user, account: account, role: :agent) }
it 'mutes conversation' do
post "/api/v1/accounts/#{account.id}/conversations/#{conversation.display_id}/mute",
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
expect(conversation.reload.resolved?).to eq(true)
expect(conversation.reload.muted?).to eq(true)
end
end
end
end