mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
DEV: Remove emoji cache dead code (#20764)
The cache is already not shared between app servers that have different app_versions, so this check was redundant.
This commit is contained in:
parent
a0a6f6d71b
commit
7b01576c8d
|
@ -65,20 +65,13 @@ class Emoji
|
|||
found_emoji = nil
|
||||
|
||||
[[global_emoji_cache, :standard], [site_emoji_cache, :custom]].each do |cache, list_key|
|
||||
cache_postfix, found_emoji =
|
||||
found_emoji =
|
||||
cache.defer_get_set(normalized_name) do
|
||||
emoji =
|
||||
Emoji
|
||||
.public_send(list_key)
|
||||
.detect { |e| e.name == normalized_name && (!is_toned || (is_toned && e.tonable)) }
|
||||
[self.cache_postfix, emoji]
|
||||
Emoji
|
||||
.public_send(list_key)
|
||||
.detect { |e| e.name == normalized_name && (!is_toned || (is_toned && e.tonable)) }
|
||||
end
|
||||
|
||||
if found_emoji && (cache_postfix != self.cache_postfix)
|
||||
cache.delete(normalized_name)
|
||||
redo
|
||||
end
|
||||
|
||||
break if found_emoji
|
||||
end
|
||||
|
||||
|
|
|
@ -91,31 +91,6 @@ RSpec.describe Emoji do
|
|||
end
|
||||
end
|
||||
|
||||
describe "version updates" do
|
||||
it "should correct cache when global emojis cache is stale" do
|
||||
Emoji.global_emoji_cache["blonde_man"] = ["invalid", Emoji.new]
|
||||
|
||||
emoji = Emoji[":blonde_man:t3"]
|
||||
|
||||
expect(emoji.name).to eq("blonde_man")
|
||||
expect(emoji.tonable).to eq(true)
|
||||
end
|
||||
|
||||
it "should correct cache when site emojis cache is stale" do
|
||||
CustomEmoji.create!(name: "test123", upload_id: 9999)
|
||||
Emoji.clear_cache
|
||||
|
||||
Emoji.site_emoji_cache["test123"] = ["invalid", Emoji.new]
|
||||
|
||||
emoji = Emoji[":test123:"]
|
||||
|
||||
expect(emoji.name).to eq("test123")
|
||||
expect(emoji.tonable).to be_falsey
|
||||
|
||||
Emoji.clear_cache
|
||||
end
|
||||
end
|
||||
|
||||
describe ".codes_to_img" do
|
||||
before { Plugin::CustomEmoji.clear_cache }
|
||||
after { Plugin::CustomEmoji.clear_cache }
|
||||
|
|
Loading…
Reference in New Issue
Block a user