fix: Unescape Slack incoming messages (#2604)

This commit is contained in:
Pranav Raj S 2021-07-09 17:45:02 +05:30 committed by GitHub
parent a9ccded62b
commit 5726447e47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View file

@ -83,7 +83,7 @@ class Integrations::Slack::IncomingMessageBuilder
message_type: :outgoing,
account_id: conversation.account_id,
inbox_id: conversation.inbox_id,
content: params[:event][:text],
content: Slack::Messages::Formatting.unescape(params[:event][:text] || ''),
external_source_id_slack: params[:event][:ts],
private: private_note?,
sender: sender

View file

@ -33,6 +33,7 @@ describe Integrations::Slack::IncomingMessageBuilder do
allow(builder).to receive(:sender).and_return(nil)
builder.perform
expect(conversation.messages.count).to eql(messages_count + 1)
expect(conversation.messages.last.content).to eql('this is test https://chatwoot.com Hey @Sojan Test again')
end
it 'does not create message for invalid event type' do

View file

@ -46,7 +46,7 @@ module SlackStubs
{
"client_msg_id": 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
"type": 'message',
"text": 'this is test',
"text": 'this is test <https://chatwoot.com> Hey <@U019KT237LP|Sojan> Test again',
"user": 'ULYPAKE5S',
"ts": '1588623033.006000',
"team": 'TLST3048H',