mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 21:06:01 +01:00
Fix empty query sent to postgres for custom emojis (#5121)
This commit is contained in:
parent
6e83b5e719
commit
3caf0ba923
1 changed files with 5 additions and 1 deletions
|
@ -33,7 +33,11 @@ class CustomEmoji < ApplicationRecord
|
||||||
class << self
|
class << self
|
||||||
def from_text(text, domain)
|
def from_text(text, domain)
|
||||||
return [] if text.blank?
|
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)
|
where(shortcode: shortcodes, domain: domain)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue