]> cat aescling's git repositories - mastodon.git/commitdiff
Add some caching for HTML versions of statuses pages (#10701)
authorThibG <thib@sitedethib.com>
Thu, 9 May 2019 20:03:44 +0000 (22:03 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 9 May 2019 20:03:44 +0000 (22:03 +0200)
app/controllers/statuses_controller.rb
app/controllers/stream_entries_controller.rb

index fc44d5fb1d09cdc37441f906ec097cadb35cf602..e60646ba33848c439e61869767e102266ab09bd4 100644 (file)
@@ -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'
 
index 8568b151cfaa4ed400feb70adcd3d1f04582caa5..b75cefa74c4bfee6e2cba423b98c7140efd00230 100644 (file)
@@ -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