From a5335d8baeffcfe8bcdb8e41f7908644b19d667f Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sat, 16 Nov 2019 22:09:29 -0600 Subject: Allow callers of `Formatter` methods to specify that formatting results should not be cached. --- app/lib/formatter.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index c190e193c..252532dc0 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -215,7 +215,7 @@ class Formatter unless status.local? html = reformat(raw_content) - Rails.cache.write("formatted_status:#{orig_status.id}", html, expires_in: CACHE_TIME) + Rails.cache.write("formatted_status:#{orig_status.id}", html, expires_in: CACHE_TIME) unless options[:cache] == false html = encode_custom_emojis(html, status.emojis, options[:autoplay]) if options[:custom_emojify] return html.html_safe # rubocop:disable Rails/OutputSafety @@ -256,7 +256,7 @@ class Formatter html = "#{html.strip}\n

— #{footer}

" end - Rails.cache.write("formatted_status:#{orig_status.id}", html, expires_in: CACHE_TIME) + Rails.cache.write("formatted_status:#{orig_status.id}", html, expires_in: CACHE_TIME) unless options[:cache] == false html = encode_custom_emojis(html, status.emojis, options[:autoplay]) if options[:custom_emojify] html.html_safe # rubocop:disable Rails/OutputSafety @@ -318,7 +318,7 @@ class Formatter html = reformat(account.note) end - Rails.cache.write("formatted_account:#{account.id}", html, expires_in: CACHE_TIME) + Rails.cache.write("formatted_account:#{account.id}", html, expires_in: CACHE_TIME) unless options[:cache] == false html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if account.local? && options[:custom_emojify] html.html_safe # rubocop:disable Rails/OutputSafety @@ -339,7 +339,7 @@ class Formatter html = encode(status.spoiler_text) - Rails.cache.write("formatted_spoiler:#{status.id}", html, expires_in: CACHE_TIME) + Rails.cache.write("formatted_spoiler:#{status.id}", html, expires_in: CACHE_TIME) unless options[:cache] == false html = encode_custom_emojis(html, status.emojis, options[:autoplay]) html.html_safe # rubocop:disable Rails/OutputSafety @@ -356,7 +356,7 @@ class Formatter html = encode(option.title) - Rails.cache.write("formatted_poll:#{status.id}:#{option.id}", html, expires_in: CACHE_TIME) + Rails.cache.write("formatted_poll:#{status.id}:#{option.id}", html, expires_in: CACHE_TIME) unless options[:cache] == false html = encode_custom_emojis(html, status.emojis, options[:autoplay]) html.html_safe # rubocop:disable Rails/OutputSafety @@ -373,7 +373,7 @@ class Formatter html = encode(account.display_name.presence || account.username) - Rails.cache.write("formatted_display_name:#{account.id}", html, expires_in: CACHE_TIME) + Rails.cache.write("formatted_display_name:#{account.id}", html, expires_in: CACHE_TIME) unless options[:cache] == false html = encode_custom_emojis(html, account.emojis, options[:autoplay]) if options[:custom_emojify] html.html_safe # rubocop:disable Rails/OutputSafety -- cgit