Merge remote-tracking branch 'parent/main' into upstream-20240112
This commit is contained in:
commit
e65fb9fb51
333 changed files with 2661 additions and 1461 deletions
|
@ -44,7 +44,7 @@ class CustomEmoji < ApplicationRecord
|
|||
|
||||
has_attached_file :image, styles: { static: { format: 'png', convert_options: '-coalesce +profile "!icc,*" +set date:modify +set date:create +set date:timestamp' } }, validate_media_type: false
|
||||
|
||||
before_validation :downcase_domain
|
||||
normalizes :domain, with: ->(domain) { domain.downcase }
|
||||
|
||||
validates_attachment :image, content_type: { content_type: IMAGE_MIME_TYPES }, presence: true, size: { less_than: LIMIT }
|
||||
validates :shortcode, uniqueness: { scope: :domain }, format: { with: SHORTCODE_ONLY_RE }, length: { minimum: 2 }
|
||||
|
@ -112,7 +112,7 @@ class CustomEmoji < ApplicationRecord
|
|||
end
|
||||
|
||||
def search(shortcode)
|
||||
where('"custom_emojis"."shortcode" ILIKE ?', "%#{shortcode}%")
|
||||
where(arel_table[:shortcode].matches("%#{sanitize_sql_like(shortcode)}%"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -122,10 +122,6 @@ class CustomEmoji < ApplicationRecord
|
|||
Rails.cache.delete(EntityCache.instance.to_key(:emoji, shortcode, domain))
|
||||
end
|
||||
|
||||
def downcase_domain
|
||||
self.domain = domain.downcase unless domain.nil?
|
||||
end
|
||||
|
||||
def set_post_size
|
||||
image.queued_for_write.each do |style, file|
|
||||
size(file.path) if style == :original
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue