Fix cache_collection crashing when given an empty collection (#15921)

* Fix cache_collection crashing when given an empty collection

* Add tests
这个提交包含在:
Claire
2021-03-18 00:41:32 +01:00
提交者 GitHub
父节点 43eff898a0
当前提交 5027abecd1
共有 4 个文件被更改,包括 65 次插入2 次删除

查看文件

@ -16,7 +16,9 @@ class EntityCache
end
def emoji(shortcodes, domain)
shortcodes = Array(shortcodes)
shortcodes = Array(shortcodes)
return [] if shortcodes.empty?
cached = Rails.cache.read_multi(*shortcodes.map { |shortcode| to_key(:emoji, shortcode, domain) })
uncached_ids = []