diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-11-16 22:09:29 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-11-16 22:09:29 -0600 |
commit | a5335d8baeffcfe8bcdb8e41f7908644b19d667f (patch) | |
tree | 295d481b8f06322b816c2c4fb300ecf8adc016f6 | |
parent | e02073f7daa5f374d158d2b0636f5edc5cec823f (diff) |
Allow callers of `Formatter` methods to specify that formatting results should not be cached.
-rw-r--r-- | app/lib/formatter.rb | 12 |
1 files 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<p class=\"signature\">— #{footer}</p>" 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 |