DEV: includes search_aliases in emoji object (#18608)
This is an information we need on client side for example when filtering emojis.
This commit is contained in:
parent
588bb2ccf2
commit
3bd94b2794
|
@ -10,7 +10,7 @@ class Emoji
|
|||
|
||||
include ActiveModel::SerializerSupport
|
||||
|
||||
attr_accessor :name, :url, :tonable, :group
|
||||
attr_accessor :name, :url, :tonable, :group, :search_aliases
|
||||
|
||||
def self.global_emoji_cache
|
||||
@global_emoji_cache ||= DistributedCache.new("global_emoji_cache", namespace: false)
|
||||
|
@ -95,6 +95,7 @@ class Emoji
|
|||
e.tonable = Emoji.tonable_emojis.include?(name)
|
||||
e.url = Emoji.url_for(filename)
|
||||
e.group = groups[name] || DEFAULT_GROUP
|
||||
e.search_aliases = search_aliases[name] || []
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -148,5 +148,10 @@ RSpec.describe Emoji do
|
|||
emoji = Emoji.create_from_db_item("name" => "scotland")
|
||||
expect(emoji.group).to eq("flags")
|
||||
end
|
||||
|
||||
it "sets the search aliases of the emoji" do
|
||||
emoji = Emoji.create_from_db_item("name" => "sad")
|
||||
expect(emoji.search_aliases).to contain_exactly("frowning_face", "slightly_frowning_face", "sob", "crying_cat_face", "cry", "face_holding_back_tears")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue