Add more server side unicode replacements for emoji
This commit is contained in:
parent
b17e5c99cc
commit
74780c1688
|
@ -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 New Issue