fix: render slack emoji shortcodes as unicode characters (#12928)
This PR fixes an issue where Slack emojis are rendered as text shortcodes (e.g. 🚀) instead of the actual emoji characters in Chatwoot messages. It introduces a new EmojiFormatter class that uses the emoji-data mapping to convert shortcodes to unicode characters. --------- Co-authored-by: Sony Mathew <sony@chatwoot.com> Co-authored-by: Sony Mathew <2040199+sony-mathew@users.noreply.github.com>
This commit is contained in:
co-authored by
Sony Mathew
Sony Mathew
parent
bcdb73502e
commit
80fccbc526
@@ -0,0 +1,20 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Integrations::Slack::EmojiFormatter do
|
||||
describe '.format' do
|
||||
it 'replaces emoji shortcodes with unicode characters' do
|
||||
expect(described_class.format('Hello :smile:')).to eq('Hello 😄')
|
||||
expect(described_class.format('Good job :+1:')).to eq('Good job 👍')
|
||||
expect(described_class.format('Unknown :unknown_emoji:')).to eq('Unknown :unknown_emoji:')
|
||||
end
|
||||
|
||||
it 'handles nil or empty text' do
|
||||
expect(described_class.format(nil)).to be_nil
|
||||
expect(described_class.format('')).to eq('')
|
||||
end
|
||||
|
||||
it 'replaces multiple emojis' do
|
||||
expect(described_class.format(':smile: :+1:')).to eq('😄 👍')
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user