]> cat aescling's git repositories - mastodon.git/commitdiff
Allow HTTP caching of atom-rendered public toots (OStatus compatibility) (#6207)
authorThibG <thib@sitedethib.com>
Fri, 2 Feb 2018 09:54:04 +0000 (10:54 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 2 Feb 2018 09:54:04 +0000 (10:54 +0100)
app/controllers/stream_entries_controller.rb

index cc579dbc8898b1c85ac41b19a5a83eaa33f76503..f81856cc6ba1c18f2eb6f2aebafc6118985364d6 100644 (file)
@@ -10,6 +10,7 @@ class StreamEntriesController < ApplicationController
   before_action :set_stream_entry
   before_action :set_link_headers
   before_action :check_account_suspension
+  before_action :set_cache_headers
 
   def show
     respond_to do |format|
@@ -19,6 +20,10 @@ class StreamEntriesController < ApplicationController
       end
 
       format.atom do
+        unless @stream_entry.hidden?
+          skip_session!
+          expires_in 3.minutes, public: true
+        end
         render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.entry(@stream_entry, true))
       end
     end