about summary refs log tree commit diff
path: root/app/controllers/activitypub/collections_controller.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-04-04 15:13:18 +0200
committerGitHub <noreply@github.com>2019-04-04 15:13:18 +0200
commit30500dff7cbf27fbee6eb45e20cc24ca0b7a9e77 (patch)
treee6022023d42dde628bb44880659104a87f985039 /app/controllers/activitypub/collections_controller.rb
parent14bad3f472b2d9887db701409db93e511e9c6f50 (diff)
parentbe6885eb93c088699465d1c50e49e8ba6d9fa3a7 (diff)
Merge pull request #981 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/activitypub/collections_controller.rb')
-rw-r--r--app/controllers/activitypub/collections_controller.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/controllers/activitypub/collections_controller.rb b/app/controllers/activitypub/collections_controller.rb
index 995da9c55..853f4f907 100644
--- a/app/controllers/activitypub/collections_controller.rb
+++ b/app/controllers/activitypub/collections_controller.rb
@@ -6,13 +6,19 @@ class ActivityPub::CollectionsController < Api::BaseController
   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