mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Allow delivery to sharedInboxes where possible (#847)
* update Activity * add instance-deliver-to-shared-inboxes setting * update activity version again * add SharedInboxURI field to accounts * serdes for endpoints/sharedInbox * deliver to sharedInbox if one is available * update tests * only assign shared inbox if shared domain * look for shared inbox if currently nil * go fmt * finger to get params.RemoteAccountID if necessary * make comments clearer * compare dns more consistently
This commit is contained in:
@@ -85,6 +85,21 @@ func (c *converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab
|
||||
inboxProp.SetIRI(inboxURI)
|
||||
person.SetActivityStreamsInbox(inboxProp)
|
||||
|
||||
// shared inbox -- only add this if we know for sure it has one
|
||||
if a.SharedInboxURI != nil && *a.SharedInboxURI != "" {
|
||||
sharedInboxURI, err := url.Parse(*a.SharedInboxURI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
endpointsProp := streams.NewActivityStreamsEndpointsProperty()
|
||||
endpoints := streams.NewActivityStreamsEndpoints()
|
||||
sharedInboxProp := streams.NewActivityStreamsSharedInboxProperty()
|
||||
sharedInboxProp.SetIRI(sharedInboxURI)
|
||||
endpoints.SetActivityStreamsSharedInbox(sharedInboxProp)
|
||||
endpointsProp.AppendActivityStreamsEndpoints(endpoints)
|
||||
person.SetActivityStreamsEndpoints(endpointsProp)
|
||||
}
|
||||
|
||||
// outbox
|
||||
// the activitypub outbox of this user for serving messages
|
||||
outboxURI, err := url.Parse(a.OutboxURI)
|
||||
|
Reference in New Issue
Block a user