fix: Add missing CSAT URL in email reply templates (#11808)
As part of PR [#11622](https://github.com/chatwoot/chatwoot/pull/11622), we intentionally hide CSAT survey URLs from agents in the dashboard to avoid exposing those links internally. However, email replies being external communications to contacts should still include the survey URLs. We missed handling that specific case for email channels. All other external channels like WhatsApp, Instagram, Telegram, etc., were already working correctly and continue to include the survey URLs as intended. --------- Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
@@ -154,6 +154,27 @@ RSpec.describe ConversationReplyMailer do
|
||||
expect(mail.message_id).to eq message.source_id
|
||||
end
|
||||
|
||||
context 'when message is a CSAT survey' do
|
||||
let(:csat_message) do
|
||||
create(:message, conversation: conversation, account: account, message_type: 'template',
|
||||
content_type: 'input_csat', content: 'How would you rate our support?', sender: agent)
|
||||
end
|
||||
|
||||
it 'includes CSAT survey URL in outgoing_content' do
|
||||
with_modified_env 'FRONTEND_URL' => 'https://app.chatwoot.com' do
|
||||
mail = described_class.email_reply(csat_message).deliver_now
|
||||
expect(mail.decoded).to include "https://app.chatwoot.com/survey/responses/#{conversation.uuid}"
|
||||
end
|
||||
end
|
||||
|
||||
it 'uses outgoing_content for CSAT message body' do
|
||||
with_modified_env 'FRONTEND_URL' => 'https://app.chatwoot.com' do
|
||||
mail = described_class.email_reply(csat_message).deliver_now
|
||||
expect(mail.decoded).to include csat_message.outgoing_content
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with email attachments' do
|
||||
it 'includes small attachments as email attachments' do
|
||||
message_with_attachment = create(:message, conversation: conversation, account: account, message_type: 'outgoing',
|
||||
|
||||
Reference in New Issue
Block a user