Fix NoMethodError in edge case of emoji cache handling (#34749)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Darius Kazemi 2025-05-28 05:39:55 -04:00 committed by GitHub
parent 71d46e26b2
commit 991796172a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,7 +26,9 @@ class EntityCache
uncached_ids << shortcode unless cached.key?(to_key(:emoji, shortcode, domain))
end
unless uncached_ids.empty?
if uncached_ids.empty?
uncached = {}
else
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) }
end