Merge tag 'v3.4.0' into hometown-dev
This commit is contained in:
@ -13,7 +13,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
||||
:inbox, :outbox, :featured, :featured_tags,
|
||||
:preferred_username, :name, :summary,
|
||||
:url, :manually_approves_followers,
|
||||
:discoverable
|
||||
:discoverable, :published
|
||||
|
||||
has_one :public_key, serializer: ActivityPub::PublicKeySerializer
|
||||
|
||||
@ -158,6 +158,10 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
||||
!object.suspended? && !object.also_known_as.empty?
|
||||
end
|
||||
|
||||
def published
|
||||
object.created_at.midnight.iso8601
|
||||
end
|
||||
|
||||
class CustomEmojiSerializer < ActivityPub::EmojiSerializer
|
||||
end
|
||||
|
||||
@ -173,7 +177,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
|
||||
end
|
||||
|
||||
def href
|
||||
explore_hashtag_url(object)
|
||||
tag_url(object)
|
||||
end
|
||||
|
||||
def name
|
||||
|
||||
@ -170,6 +170,8 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
|
||||
attributes :type, :media_type, :url, :name, :blurhash
|
||||
attribute :focal_point, if: :focal_point?
|
||||
attribute :width, if: :width?
|
||||
attribute :height, if: :height?
|
||||
|
||||
has_one :icon, serializer: ActivityPub::ImageSerializer, if: :thumbnail?
|
||||
|
||||
@ -204,6 +206,22 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
def thumbnail?
|
||||
object.thumbnail.present?
|
||||
end
|
||||
|
||||
def width?
|
||||
object.file.meta&.dig('original', 'width').present?
|
||||
end
|
||||
|
||||
def height?
|
||||
object.file.meta&.dig('original', 'height').present?
|
||||
end
|
||||
|
||||
def width
|
||||
object.file.meta.dig('original', 'width')
|
||||
end
|
||||
|
||||
def height
|
||||
object.file.meta.dig('original', 'height')
|
||||
end
|
||||
end
|
||||
|
||||
class MentionSerializer < ActivityPub::Serializer
|
||||
|
||||
@ -55,6 +55,10 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||
full_asset_url(object.suspended? ? object.header.default_url : object.header_static_url)
|
||||
end
|
||||
|
||||
def created_at
|
||||
object.created_at.midnight.as_json
|
||||
end
|
||||
|
||||
def last_status_at
|
||||
object.last_status_at&.to_date&.iso8601
|
||||
end
|
||||
|
||||
@ -9,7 +9,9 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||
|
||||
has_one :contact_account, serializer: REST::AccountSerializer
|
||||
|
||||
delegate :contact_account, to: :instance_presenter
|
||||
has_many :rules, serializer: REST::RuleSerializer
|
||||
|
||||
delegate :contact_account, :rules, to: :instance_presenter
|
||||
|
||||
def uri
|
||||
Rails.configuration.x.local_domain
|
||||
|
||||
9
app/serializers/rest/rule_serializer.rb
Normal file
9
app/serializers/rest/rule_serializer.rb
Normal file
@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::RuleSerializer < ActiveModel::Serializer
|
||||
attributes :id, :text
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
end
|
||||
7
app/serializers/rest/suggestion_serializer.rb
Normal file
7
app/serializers/rest/suggestion_serializer.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::SuggestionSerializer < ActiveModel::Serializer
|
||||
attributes :source
|
||||
|
||||
has_one :account, serializer: REST::AccountSerializer
|
||||
end
|
||||
Reference in New Issue
Block a user