about summary refs log tree commit diff
path: root/app/controllers/activitypub/collections_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-07-08 12:03:45 +0200
committerGitHub <noreply@github.com>2019-07-08 12:03:45 +0200
commit63c7fe8e4892b22e80c015bf0ecb04496318623b (patch)
treec724cb6e1006dbd1d5cccd3719d096ff62124644 /app/controllers/activitypub/collections_controller.rb
parentf14776475d285bb7d2831a20192c1611c733f410 (diff)
Refactor controllers for statuses, accounts, and more (#11249)
Diffstat (limited to 'app/controllers/activitypub/collections_controller.rb')
-rw-r--r--app/controllers/activitypub/collections_controller.rb16
1 files changed, 3 insertions, 13 deletions
diff --git a/app/controllers/activitypub/collections_controller.rb b/app/controllers/activitypub/collections_controller.rb
index 012c3c538..dd2f111b0 100644
--- a/app/controllers/activitypub/collections_controller.rb
+++ b/app/controllers/activitypub/collections_controller.rb
@@ -2,29 +2,19 @@
 
 class ActivityPub::CollectionsController < Api::BaseController
   include SignatureVerification
+  include AccountOwnedConcern
 
-  before_action :set_account
   before_action :set_size
   before_action :set_statuses
   before_action :set_cache_headers
 
   def show
-    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
+    expires_in 3.minutes, public: true
+    render json: collection_presenter, content_type: 'application/activity+json', serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, skip_activities: true
   end
 
   private
 
-  def set_account
-    @account = Account.find_local!(params[:account_username])
-  end
-
   def set_statuses
     @statuses = scope_for_collection
     @statuses = cache_collection(@statuses, Status)