diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-01-04 01:21:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-04 01:21:38 +0100 |
commit | c10f4bdb037d87444a76e52e85f046e7e59d753a (patch) | |
tree | 52298920f6f4bae47bf6ef5f23f1d43b7e4d0997 /app/controllers/emojis_controller.rb | |
parent | d907d4352e9b6cb22bc1fabd42ca3fc60aef8a37 (diff) |
Cache JSON of immutable ActivityPub representations (#6171)
Diffstat (limited to 'app/controllers/emojis_controller.rb')
-rw-r--r-- | app/controllers/emojis_controller.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/controllers/emojis_controller.rb b/app/controllers/emojis_controller.rb index a82b9340b..c9725ccc0 100644 --- a/app/controllers/emojis_controller.rb +++ b/app/controllers/emojis_controller.rb @@ -2,14 +2,16 @@ class EmojisController < ApplicationController before_action :set_emoji + before_action :set_cache_headers def show respond_to do |format| format.json do - render json: @emoji, - serializer: ActivityPub::EmojiSerializer, - adapter: ActivityPub::Adapter, - content_type: 'application/activity+json' + skip_session! + + render_cached_json(['activitypub', 'emoji', @emoji.cache_key], content_type: 'application/activity+json') do + ActiveModelSerializers::SerializableResource.new(@emoji, serializer: ActivityPub::EmojiSerializer, adapter: ActivityPub::Adapter) + end end end end |