fix: Unescape Slack incoming messages (#2604)
This commit is contained in:
parent
a9ccded62b
commit
5726447e47
3 changed files with 3 additions and 2 deletions
|
@ -83,7 +83,7 @@ class Integrations::Slack::IncomingMessageBuilder
|
||||||
message_type: :outgoing,
|
message_type: :outgoing,
|
||||||
account_id: conversation.account_id,
|
account_id: conversation.account_id,
|
||||||
inbox_id: conversation.inbox_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],
|
external_source_id_slack: params[:event][:ts],
|
||||||
private: private_note?,
|
private: private_note?,
|
||||||
sender: sender
|
sender: sender
|
||||||
|
|
|
@ -33,6 +33,7 @@ describe Integrations::Slack::IncomingMessageBuilder do
|
||||||
allow(builder).to receive(:sender).and_return(nil)
|
allow(builder).to receive(:sender).and_return(nil)
|
||||||
builder.perform
|
builder.perform
|
||||||
expect(conversation.messages.count).to eql(messages_count + 1)
|
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
|
end
|
||||||
|
|
||||||
it 'does not create message for invalid event type' do
|
it 'does not create message for invalid event type' do
|
||||||
|
|
|
@ -46,7 +46,7 @@ module SlackStubs
|
||||||
{
|
{
|
||||||
"client_msg_id": 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
|
"client_msg_id": 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
|
||||||
"type": 'message',
|
"type": 'message',
|
||||||
"text": 'this is test',
|
"text": 'this is test <https://chatwoot.com> Hey <@U019KT237LP|Sojan> Test again',
|
||||||
"user": 'ULYPAKE5S',
|
"user": 'ULYPAKE5S',
|
||||||
"ts": '1588623033.006000',
|
"ts": '1588623033.006000',
|
||||||
"team": 'TLST3048H',
|
"team": 'TLST3048H',
|
||||||
|
|
Loading…
Reference in a new issue