0
0
Fork 0

Refactor controllers for statuses, accounts, and more (#11249)

This commit is contained in:
Eugen Rochko 2019-07-08 12:03:45 +02:00 committed by GitHub
parent f14776475d
commit 63c7fe8e48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 299 additions and 289 deletions

View file

@ -1,9 +1,12 @@
# frozen_string_literal: true
class ActivityPub::ActivitySerializer < ActivityPub::Serializer
cache key: 'activity', expires_in: 3.minutes
attributes :id, :type, :actor, :published, :to, :cc
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, if: :serialize_object?
attribute :proper_uri, key: :object, unless: :serialize_object?
attribute :atom_uri, if: :announce?

View file

@ -3,6 +3,8 @@
class ActivityPub::ActorSerializer < ActivityPub::Serializer
include RoutingHelper
cache key: 'actor', expires_in: 3.minutes
context :security
context_extensions :manually_approves_followers, :featured, :also_known_as,

View file

@ -7,6 +7,8 @@ class ActivityPub::CollectionSerializer < ActivityPub::Serializer
super
end
cache key: 'collection', expires_in: 3.minutes
attribute :id, if: -> { object.id.present? }
attribute :type
attribute :total_items, if: -> { object.size.present? }

View file

@ -3,6 +3,8 @@
class ActivityPub::EmojiSerializer < ActivityPub::Serializer
include RoutingHelper
cache key: 'emoji', expires_in: 3.minutes
context_extensions :emoji
attributes :id, :type, :name, :updated

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class ActivityPub::NoteSerializer < ActivityPub::Serializer
cache key: 'note', expires_in: 3.minutes
context_extensions :atom_uri, :conversation, :sensitive,
:hashtag, :emoji, :focal_point, :blurhash