before_action :set_account
before_action :set_size
before_action :set_statuses
+ before_action :set_cache_headers
def show
- render json: collection_presenter,
- serializer: ActivityPub::CollectionSerializer,
- adapter: ActivityPub::Adapter,
- content_type: 'application/activity+json',
- skip_activities: true
+ skip_session!
+
+ render_cached_json(['activitypub', 'collection', @account, params[:id]], content_type: 'application/activity+json') do
+ ActiveModelSerializers::SerializableResource.new(
+ collection_presenter,
+ serializer: ActivityPub::CollectionSerializer,
+ adapter: ActivityPub::Adapter,
+ skip_activities: true
+ )
+ end
end
private
before_action :set_account
before_action :set_statuses
+ before_action :set_cache_headers
def show
+ unless page_requested?
+ skip_session!
+ expires_in 1.minute, public: true
+ end
+
render json: outbox_presenter, serializer: ActivityPub::OutboxSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
end
class FollowerAccountsController < ApplicationController
include AccountControllerConcern
+ before_action :set_cache_headers
+
def index
respond_to do |format|
format.html do
format.json do
raise Mastodon::NotPermittedError if params[:page].present? && @account.user_hides_network?
+ if params[:page].blank?
+ skip_session!
+ expires_in 3.minutes, public: true
+ end
+
render json: collection_presenter,
serializer: ActivityPub::CollectionSerializer,
adapter: ActivityPub::Adapter,
class FollowingAccountsController < ApplicationController
include AccountControllerConcern
+ before_action :set_cache_headers
+
def index
respond_to do |format|
format.html do
+ mark_cacheable! unless user_signed_in?
+
next if @account.user_hides_network?
follows
format.json do
raise Mastodon::NotPermittedError if params[:page].present? && @account.user_hides_network?
+ if params[:page].blank?
+ skip_session!
+ expires_in 3.minutes, public: true
+ end
+
render json: collection_presenter,
serializer: ActivityPub::CollectionSerializer,
adapter: ActivityPub::Adapter,