From: Eugen Rochko Date: Wed, 27 Sep 2017 02:14:03 +0000 (+0200) Subject: Fix empty query sent to postgres for custom emojis (#5121) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=3caf0ba92313c71d722b30f77c5c1355601fc7c1;p=mastodon.git Fix empty query sent to postgres for custom emojis (#5121) --- diff --git a/app/models/custom_emoji.rb b/app/models/custom_emoji.rb index aff9f8dfa..e80c58155 100644 --- a/app/models/custom_emoji.rb +++ b/app/models/custom_emoji.rb @@ -33,7 +33,11 @@ class CustomEmoji < ApplicationRecord class << self def from_text(text, domain) return [] if text.blank? - shortcodes = text.scan(SCAN_RE).map(&:first) + + shortcodes = text.scan(SCAN_RE).map(&:first).uniq + + return [] if shortcodes.empty? + where(shortcode: shortcodes, domain: domain) end end