FIX: Fix the emoji toned regexes (#20763)
This commit is contained in:
parent
0562f952ed
commit
a0a6f6d71b
|
@ -59,8 +59,8 @@ class Emoji
|
|||
|
||||
def self.[](name)
|
||||
name = name.delete_prefix(":").delete_suffix(":")
|
||||
is_toned = name.match?(/.+:t[1-6]/)
|
||||
normalized_name = name.gsub(/(.+):t[1-6]/, '\1')
|
||||
is_toned = name.match?(/\A.+:t[1-6]\z/)
|
||||
normalized_name = name.gsub(/\A(.+):t[1-6]\z/, '\1')
|
||||
|
||||
found_emoji = nil
|
||||
|
||||
|
|
|
@ -76,6 +76,13 @@ RSpec.describe Emoji do
|
|||
expect(Emoji.exists?("test")).to be(true)
|
||||
end
|
||||
|
||||
it "finds a custom emoji with a name with :t1 in the middle" do
|
||||
CustomEmoji.create!(name: "test:t1:foo", upload_id: 9999)
|
||||
Emoji.clear_cache
|
||||
expect(Emoji.exists?(":test:t1:foo:")).to be(true)
|
||||
expect(Emoji.exists?("test:t1:foo")).to be(true)
|
||||
end
|
||||
|
||||
it "doesn’t find non-existing emoji" do
|
||||
expect(Emoji.exists?(":foo-bar:")).to be(false)
|
||||
expect(Emoji.exists?(":blonde_woman:t7:")).to be(false)
|
||||
|
|
Loading…
Reference in New Issue