about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-05-09 22:03:44 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-05-09 22:03:44 +0200
commit26fc21c18844802652ff1f5910acaa91ebe19de4 (patch)
tree7adcd08bb9f22e519faede48259a36d497b50f9c
parent0402c52f28b73824d7c81c702a16d39fd97808cf (diff)
Add some caching for HTML versions of statuses pages (#10701)
-rw-r--r--app/controllers/statuses_controller.rb5
-rw-r--r--app/controllers/stream_entries_controller.rb5
2 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb
index fc44d5fb1..e60646ba3 100644
--- a/app/controllers/statuses_controller.rb
+++ b/app/controllers/statuses_controller.rb
@@ -27,7 +27,10 @@ class StatusesController < ApplicationController
   def show
     respond_to do |format|
       format.html do
-        mark_cacheable! unless user_signed_in?
+        unless user_signed_in?
+          skip_session!
+          expires_in 10.seconds, public: true
+        end
 
         @body_classes = 'with-modals'
 
diff --git a/app/controllers/stream_entries_controller.rb b/app/controllers/stream_entries_controller.rb
index 8568b151c..b75cefa74 100644
--- a/app/controllers/stream_entries_controller.rb
+++ b/app/controllers/stream_entries_controller.rb
@@ -15,6 +15,11 @@ class StreamEntriesController < ApplicationController
   def show
     respond_to do |format|
       format.html do
+        unless user_signed_in?
+          skip_session!
+          expires_in 5.minutes, public: true
+        end
+
         redirect_to short_account_status_url(params[:account_username], @stream_entry.activity) if @type == 'status'
       end