Fix NoMethodError
in edge case of emoji cache handling (#34749)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
71d46e26b2
commit
991796172a
1 changed files with 3 additions and 1 deletions
|
@ -26,7 +26,9 @@ class EntityCache
|
||||||
uncached_ids << shortcode unless cached.key?(to_key(:emoji, shortcode, domain))
|
uncached_ids << shortcode unless cached.key?(to_key(:emoji, shortcode, domain))
|
||||||
end
|
end
|
||||||
|
|
||||||
unless uncached_ids.empty?
|
if uncached_ids.empty?
|
||||||
|
uncached = {}
|
||||||
|
else
|
||||||
uncached = CustomEmoji.enabled.where(shortcode: shortcodes, domain: domain).index_by(&:shortcode)
|
uncached = CustomEmoji.enabled.where(shortcode: shortcodes, domain: domain).index_by(&:shortcode)
|
||||||
uncached.each_value { |item| Rails.cache.write(to_key(:emoji, item.shortcode, domain), item, expires_in: MAX_EXPIRATION) }
|
uncached.each_value { |item| Rails.cache.write(to_key(:emoji, item.shortcode, domain), item, expires_in: MAX_EXPIRATION) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue