mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-17 09:37:33 -06:00
[bugfix] Ensure id set on outgoing Reject + Accept (#3312)
This commit is contained in:
parent
d4d6631435
commit
4bd5e68b2b
2 changed files with 54 additions and 54 deletions
|
|
@ -2005,3 +2005,49 @@ func (c *Converter) InteractionReqToASAccept(
|
|||
|
||||
return accept, nil
|
||||
}
|
||||
|
||||
// InteractionReqToASReject converts a *gtsmodel.InteractionRequest
|
||||
// to an ActivityStreams Reject, addressed to the interacting account.
|
||||
func (c *Converter) InteractionReqToASReject(
|
||||
ctx context.Context,
|
||||
req *gtsmodel.InteractionRequest,
|
||||
) (vocab.ActivityStreamsReject, error) {
|
||||
reject := streams.NewActivityStreamsReject()
|
||||
|
||||
rejectID, err := url.Parse(req.URI)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("invalid reject uri: %w", err)
|
||||
}
|
||||
|
||||
actorIRI, err := url.Parse(req.TargetAccount.URI)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("invalid account uri: %w", err)
|
||||
}
|
||||
|
||||
objectIRI, err := url.Parse(req.InteractionURI)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("invalid target uri: %w", err)
|
||||
}
|
||||
|
||||
toIRI, err := url.Parse(req.InteractingAccount.URI)
|
||||
if err != nil {
|
||||
return nil, gtserror.Newf("invalid interacting account uri: %w", err)
|
||||
}
|
||||
|
||||
// Set id to the URI of
|
||||
// interaction request.
|
||||
ap.SetJSONLDId(reject, rejectID)
|
||||
|
||||
// Actor is the account that
|
||||
// owns the approval / reject.
|
||||
ap.AppendActorIRIs(reject, actorIRI)
|
||||
|
||||
// Object is the interaction URI.
|
||||
ap.AppendObjectIRIs(reject, objectIRI)
|
||||
|
||||
// Address to the owner
|
||||
// of interaction URI.
|
||||
ap.AppendTo(reject, toIRI)
|
||||
|
||||
return reject, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue