Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - Gemfile - Gemfile.lock - app/controllers/about_controller.rb - app/controllers/auth/sessions_controller.rb
This commit is contained in:
26
app/serializers/activitypub/move_serializer.rb
Normal file
26
app/serializers/activitypub/move_serializer.rb
Normal file
@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::MoveSerializer < ActivityPub::Serializer
|
||||
attributes :id, :type, :target, :actor
|
||||
attribute :virtual_object, key: :object
|
||||
|
||||
def id
|
||||
[ActivityPub::TagManager.instance.uri_for(object.account), '#moves/', object.id].join
|
||||
end
|
||||
|
||||
def type
|
||||
'Move'
|
||||
end
|
||||
|
||||
def target
|
||||
ActivityPub::TagManager.instance.uri_for(object.target_account)
|
||||
end
|
||||
|
||||
def virtual_object
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
context_extensions :atom_uri, :conversation, :sensitive
|
||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count
|
||||
|
||||
attributes :id, :type, :summary,
|
||||
:in_reply_to, :published, :url,
|
||||
@ -23,6 +23,8 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
attribute :end_time, if: :poll_and_expires?
|
||||
attribute :closed, if: :poll_and_expired?
|
||||
|
||||
attribute :voters_count, if: :poll_and_voters_count?
|
||||
|
||||
def id
|
||||
raise Mastodon::NotPermittedError, 'Local-only statuses should not be serialized' if object.local_only? && !instance_options[:allow_local_only]
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
@ -142,6 +144,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
|
||||
alias end_time closed
|
||||
|
||||
def voters_count
|
||||
object.preloadable_poll.voters_count
|
||||
end
|
||||
|
||||
def poll_and_expires?
|
||||
object.preloadable_poll&.expires_at&.present?
|
||||
end
|
||||
@ -150,6 +156,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
object.preloadable_poll&.expired?
|
||||
end
|
||||
|
||||
def poll_and_voters_count?
|
||||
object.preloadable_poll&.voters_count
|
||||
end
|
||||
|
||||
class MediaAttachmentSerializer < ActivityPub::Serializer
|
||||
context_extensions :blurhash, :focal_point
|
||||
|
||||
|
Reference in New Issue
Block a user