Progress on DMs responsiveness
Progress on DMs responsiveness
This commit is contained in:
@@ -434,7 +434,7 @@ class Account < ApplicationRecord
|
||||
end
|
||||
|
||||
def emojis
|
||||
@emojis ||= CustomEmoji.from_text(emojifiable_text, domain)
|
||||
@emojis ||= CustomEmoji.from_text(emojifiable_text)
|
||||
end
|
||||
|
||||
before_create :generate_keys
|
||||
|
||||
@@ -25,4 +25,9 @@ class ChatMessage < ApplicationRecord
|
||||
|
||||
scope :recent, -> { reorder(created_at: :desc) }
|
||||
|
||||
def emojis
|
||||
return @emojis if defined?(@emojis)
|
||||
|
||||
@emojis = CustomEmoji.from_text(text)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -54,14 +54,14 @@ class CustomEmoji < ApplicationRecord
|
||||
end
|
||||
|
||||
class << self
|
||||
def from_text(text, domain)
|
||||
def from_text(text)
|
||||
return [] if text.blank?
|
||||
|
||||
shortcodes = text.scan(SCAN_RE).map(&:first).uniq
|
||||
|
||||
return [] if shortcodes.empty?
|
||||
|
||||
EntityCache.instance.emoji(shortcodes, domain)
|
||||
EntityCache.instance.emoji(shortcodes)
|
||||
end
|
||||
|
||||
def search(shortcode)
|
||||
@@ -72,10 +72,7 @@ class CustomEmoji < ApplicationRecord
|
||||
private
|
||||
|
||||
def remove_entity_cache
|
||||
Rails.cache.delete(EntityCache.instance.to_key(:emoji, shortcode, domain))
|
||||
Rails.cache.delete(EntityCache.instance.to_key(:emoji, shortcode,))
|
||||
end
|
||||
|
||||
def downcase_domain
|
||||
self.domain = domain.downcase unless domain.nil?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ class Poll < ApplicationRecord
|
||||
end
|
||||
|
||||
def emojis
|
||||
@emojis ||= CustomEmoji.from_text(options.join(' '), account.domain)
|
||||
@emojis ||= CustomEmoji.from_text(options.join(' '))
|
||||
end
|
||||
|
||||
class Option < ActiveModelSerializers::Model
|
||||
|
||||
@@ -231,7 +231,7 @@ class Status < ApplicationRecord
|
||||
fields = [spoiler_text, text]
|
||||
fields += preloadable_poll.options unless preloadable_poll.nil?
|
||||
|
||||
@emojis = CustomEmoji.from_text(fields.join(' '), account.domain)
|
||||
@emojis = CustomEmoji.from_text(fields.join(' '))
|
||||
end
|
||||
|
||||
def mark_for_mass_destruction!
|
||||
|
||||
Reference in New Issue
Block a user