mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-31 05:42:13 +02:00
19 lines
662 B
Ruby
19 lines
662 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UserSerializer < Panko::Serializer
|
|
attributes :id, :type, :name, :url, :summary
|
|
aliases document_context: :@context
|
|
aliases created_at: :published
|
|
aliases screen_name: "preferredUsername"
|
|
|
|
has_one :profile_picture, serializer: ImageSerializer, name: :icon
|
|
has_one :profile_header, serializer: ImageSerializer, name: :image
|
|
|
|
def document_context = %w[https://www.w3.org/ns/activitystreams]
|
|
|
|
def id = context[:controller].activitypub_user_url(object)
|
|
def url = context[:controller].user_url(object)
|
|
def type = "Person"
|
|
def name = object.profile.display_name
|
|
def summary = object.profile.description
|
|
end
|