about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/custom_emoji.rb6
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