diff options
| author | 2024-02-17 15:20:39 +0100 | |
|---|---|---|
| committer | 2024-02-17 15:20:39 +0100 | |
| commit | d3f35e8eba602dd963a395b304c778e0a776869d (patch) | |
| tree | b7dde8d924ad19c657d60c584463278522966298 /internal/federation/federatingdb/announce.go | |
| parent | [chore] Simplify the User-Agent string (#2645) (diff) | |
| download | gotosocial-d3f35e8eba602dd963a395b304c778e0a776869d.tar.xz | |
[chore] refactor extractFromCtx a bit (#2646)
Diffstat (limited to 'internal/federation/federatingdb/announce.go')
| -rw-r--r-- | internal/federation/federatingdb/announce.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/internal/federation/federatingdb/announce.go b/internal/federation/federatingdb/announce.go index b1bd51659..2ce6d1c59 100644 --- a/internal/federation/federatingdb/announce.go +++ b/internal/federation/federatingdb/announce.go @@ -41,22 +41,25 @@ func (f *federatingDB) Announce(ctx context.Context, announce vocab.ActivityStre l.Debug("entering Announce") } - receivingAccount, requestingAccount, internal := extractFromCtx(ctx) - if internal { + activityContext := getActivityContext(ctx) + if activityContext.internal { return nil // Already processed. } + requestingAcct := activityContext.requestingAcct + receivingAcct := activityContext.receivingAcct + // Ensure requestingAccount is among // the Actors doing the Announce. // // We don't support Announce forwards. actorIRIs := ap.GetActorIRIs(announce) if !slices.ContainsFunc(actorIRIs, func(actorIRI *url.URL) bool { - return actorIRI.String() == requestingAccount.URI + return actorIRI.String() == requestingAcct.URI }) { return gtserror.Newf( "requestingAccount %s was not among Announce Actors", - requestingAccount.URI, + requestingAcct.URI, ) } @@ -76,7 +79,7 @@ func (f *federatingDB) Announce(ctx context.Context, announce vocab.ActivityStre APObjectType: ap.ActivityAnnounce, APActivityType: ap.ActivityCreate, GTSModel: boost, - ReceivingAccount: receivingAccount, + ReceivingAccount: receivingAcct, }) return nil |
