mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 12:27:28 -06:00
[feature] Distribute + ingest Accepts to followers (#3404)
This commit is contained in:
parent
99f535f99b
commit
1e421cb912
9 changed files with 607 additions and 250 deletions
|
|
@ -1988,6 +1988,16 @@ func (c *Converter) InteractionReqToASAccept(
|
|||
return nil, gtserror.Newf("invalid interacting account uri: %w", err)
|
||||
}
|
||||
|
||||
publicIRI, err := url.Parse(pub.PublicActivityPubIRI)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("invalid public uri: %w", err)
|
||||
}
|
||||
|
||||
followersIRI, err := url.Parse(req.TargetAccount.FollowersURI)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("invalid followers uri: %w", err)
|
||||
}
|
||||
|
||||
// Set id to the URI of
|
||||
// interaction request.
|
||||
ap.SetJSONLDId(accept, acceptID)
|
||||
|
|
@ -2003,6 +2013,9 @@ func (c *Converter) InteractionReqToASAccept(
|
|||
// of interaction URI.
|
||||
ap.AppendTo(accept, toIRI)
|
||||
|
||||
// Cc to the actor's followers, and to Public.
|
||||
ap.AppendCc(accept, publicIRI, followersIRI)
|
||||
|
||||
return accept, nil
|
||||
}
|
||||
|
||||
|
|
@ -2034,6 +2047,16 @@ func (c *Converter) InteractionReqToASReject(
|
|||
return nil, gtserror.Newf("invalid interacting account uri: %w", err)
|
||||
}
|
||||
|
||||
publicIRI, err := url.Parse(pub.PublicActivityPubIRI)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("invalid public uri: %w", err)
|
||||
}
|
||||
|
||||
followersIRI, err := url.Parse(req.TargetAccount.FollowersURI)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("invalid followers uri: %w", err)
|
||||
}
|
||||
|
||||
// Set id to the URI of
|
||||
// interaction request.
|
||||
ap.SetJSONLDId(reject, rejectID)
|
||||
|
|
@ -2049,5 +2072,8 @@ func (c *Converter) InteractionReqToASReject(
|
|||
// of interaction URI.
|
||||
ap.AppendTo(reject, toIRI)
|
||||
|
||||
// Cc to the actor's followers, and to Public.
|
||||
ap.AppendCc(reject, publicIRI, followersIRI)
|
||||
|
||||
return reject, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1181,6 +1181,10 @@ func (suite *InternalToASTestSuite) TestInteractionReqToASAccept() {
|
|||
suite.Equal(`{
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"actor": "http://localhost:8080/users/the_mighty_zork",
|
||||
"cc": [
|
||||
"https://www.w3.org/ns/activitystreams#Public",
|
||||
"http://localhost:8080/users/the_mighty_zork/followers"
|
||||
],
|
||||
"id": "http://localhost:8080/users/the_mighty_zork/accepts/01J1AKMZ8JE5NW0ZSFTRC1JJNE",
|
||||
"object": "https://fossbros-anonymous.io/users/foss_satan/statuses/01J1AKRRHQ6MDDQHV0TP716T2K",
|
||||
"to": "http://fossbros-anonymous.io/users/foss_satan",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue