mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-24 03:02:42 +00:00
Implement FEP 7888: Part 1 - publish conversation context (#35959)
This commit is contained in:
parent
9463a31107
commit
65b4a0a6f1
15 changed files with 309 additions and 12 deletions
11
app/serializers/activitypub/context_serializer.rb
Normal file
11
app/serializers/activitypub/context_serializer.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::ContextSerializer < ActivityPub::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
attributes :id, :type, :attributed_to, :first
|
||||
|
||||
def type
|
||||
'Collection'
|
||||
end
|
||||
end
|
||||
|
|
@ -9,7 +9,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
|||
:in_reply_to, :published, :url,
|
||||
:attributed_to, :to, :cc, :sensitive,
|
||||
:atom_uri, :in_reply_to_atom_uri,
|
||||
:conversation
|
||||
:conversation, :context
|
||||
|
||||
attribute :content
|
||||
attribute :content_map, if: :language?
|
||||
|
|
@ -163,6 +163,12 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
|||
end
|
||||
end
|
||||
|
||||
def context
|
||||
return if object.conversation.nil?
|
||||
|
||||
ActivityPub::TagManager.instance.uri_for(object.conversation)
|
||||
end
|
||||
|
||||
def local?
|
||||
object.account.local?
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue