Progress on DMs responsiveness

Progress on DMs responsiveness
This commit is contained in:
mgabdev
2020-12-03 22:27:09 -05:00
parent 137a36b810
commit f6a7422704
29 changed files with 682 additions and 186 deletions

View File

@@ -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