Skip to content

Commit

Permalink
Add some caching for HTML versions of statuses pages (mastodon#10701)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored and hiyuki2578 committed Oct 2, 2019
1 parent 9b73faf commit aed6930
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
5 changes: 5 additions & 0 deletions app/controllers/stream_entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit aed6930

Please sign in to comment.