fix(inboxes): block disabled inbox side effects

This commit is contained in:
Muhsin
2026-07-22 16:51:49 +04:00
parent 97b30127a6
commit f855429d9a
6 changed files with 45 additions and 2 deletions
@@ -274,6 +274,19 @@ RSpec.describe '/api/v1/widget/conversations/toggle_typing', type: :request do
describe 'POST /api/v1/widget/conversations/transcript' do
context 'with a conversation' do
it 'does not send transcript email when the inbox is disabled' do
web_widget.inbox.update!(active: false)
contact.update!(email: 'test@test.com')
expect(ConversationReplyMailer).not_to receive(:with)
post '/api/v1/widget/conversations/transcript',
headers: { 'X-Auth-Token' => token },
params: { website_token: web_widget.website_token },
as: :json
expect(response).to have_http_status(:forbidden)
end
it 'sends transcript email' do
contact.update(email: 'test@test.com')
mailer = double