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

@@ -11,7 +11,7 @@ class EntityCache
Rails.cache.fetch(to_key(:mention, username, domain), expires_in: MAX_EXPIRATION) { Account.select(:username, :domain, :url).find_local(username) }
end
def emoji(shortcodes, domain)
def emoji(shortcodes, domain = nil)
shortcodes = [shortcodes] unless shortcodes.is_a?(Array)
cached = Rails.cache.read_multi(*shortcodes.map { |shortcode| to_key(:emoji, shortcode, domain) })
uncached_ids = []

View File

@@ -80,6 +80,21 @@ class Formatter
include ActionView::Helpers::TextHelper
def chatMessageText(chatMessage)
raw_content = chatMessage.text
return '' if raw_content.blank?
html = raw_content
html = encode_and_link_urls(html, nil, keep_html: false)
html = reformat(html, true)
html = encode_custom_emojis(html, chatMessage.emojis)
html.html_safe # rubocop:disable Rails/OutputSafety
html
end
def format(status, **options)
if options[:use_markdown]
raw_content = status.markdown