about summary refs log tree commit diff
path: root/app/models/custom_emoji.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-08-25 20:39:40 +0200
committerGitHub <noreply@github.com>2022-08-25 20:39:40 +0200
commit0396acf39ea902688374fac65fa7ef5dc4c05512 (patch)
treef5349303e930976f8accd22453dd4bc5024c32f5 /app/models/custom_emoji.rb
parent99aed9069d4319d53779c483142e6649f3fef17b (diff)
Add audit log entries for user roles (#19040)
* Refactor audit log schema

* Add audit log entries for user roles
Diffstat (limited to 'app/models/custom_emoji.rb')
-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 289e3b66f..077ce559a 100644
--- a/app/models/custom_emoji.rb
+++ b/app/models/custom_emoji.rb
@@ -46,7 +46,7 @@ class CustomEmoji < ApplicationRecord
   scope :local, -> { where(domain: nil) }
   scope :remote, -> { where.not(domain: nil) }
   scope :alphabetic, -> { order(domain: :asc, shortcode: :asc) }
-  scope :by_domain_and_subdomains, ->(domain) { where(domain: domain).or(where(arel_table[:domain].matches('%.' + domain))) }
+  scope :by_domain_and_subdomains, ->(domain) { where(domain: domain).or(where(arel_table[:domain].matches("%.#{domain}"))) }
   scope :listed, -> { local.where(disabled: false).where(visible_in_picker: true) }
 
   remotable_attachment :image, LIMIT
@@ -67,6 +67,10 @@ class CustomEmoji < ApplicationRecord
     copy.tap(&:save!)
   end
 
+  def to_log_human_identifier
+    shortcode
+  end
+
   class << self
     def from_text(text, domain = nil)
       return [] if text.blank?