mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-17 19:12:37 -05:00
Add more server side unicode replacements for emoji
This commit is contained in:
parent
b17e5c99cc
commit
74780c1688
2 changed files with 14 additions and 1 deletions
|
@ -119,7 +119,16 @@ class Emoji
|
|||
end
|
||||
|
||||
def self.unicode_replacements
|
||||
@unicode_replacements ||= Hash[db.map {|e| [e['emoji'], e['aliases'][0]] }]
|
||||
return @unicode_replacements if @unicode_replacements
|
||||
|
||||
@unicode_replacements = Hash[db.map {|e| [e['emoji'], e['aliases'][0]] }]
|
||||
@unicode_replacements["\u{2639}"] = 'frowning'
|
||||
@unicode_replacements["\u{263A}"] = 'slightly_smiling'
|
||||
@unicode_replacements["\u{263B}"] = 'slightly_smiling'
|
||||
@unicode_replacements["\u{2661}"] = 'heart'
|
||||
@unicode_replacements["\u{2665}"] = 'heart'
|
||||
|
||||
@unicode_replacements
|
||||
end
|
||||
|
||||
def self.unicode_regexp
|
||||
|
|
|
@ -385,6 +385,10 @@ HTML
|
|||
expect(PrettyText.cook("💣")).to match(/\:bomb\:/)
|
||||
end
|
||||
|
||||
it "replaces some glyphs that are not in the emoji range" do
|
||||
expect(PrettyText.cook("☺")).to match(/\:slightly_smiling\:/)
|
||||
end
|
||||
|
||||
it "doesn't replace unicode emoji if emoji is disabled" do
|
||||
SiteSetting.enable_emoji = false
|
||||
expect(PrettyText.cook("💣")).not_to match(/\:bomb\:/)
|
||||
|
|
Loading…
Reference in a new issue