diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-09-27 04:14:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-27 04:14:03 +0200 |
commit | 3caf0ba92313c71d722b30f77c5c1355601fc7c1 (patch) | |
tree | 1dc3924c28cf303b88a029d3cf3ab7790f78ecea | |
parent | 6e83b5e719cf58a554681859c0b74df626bb66a1 (diff) |
Fix empty query sent to postgres for custom emojis (#5121)
-rw-r--r-- | app/models/custom_emoji.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |