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/reject.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/reject.go')
-rw-r--r-- | internal/federation/federatingdb/reject.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/federation/federatingdb/reject.go b/internal/federation/federatingdb/reject.go index 738087d62..929559031 100644 --- a/internal/federation/federatingdb/reject.go +++ b/internal/federation/federatingdb/reject.go @@ -40,11 +40,14 @@ func (f *federatingDB) Reject(ctx context.Context, reject vocab.ActivityStreamsR l.Debug("entering Reject") } - receivingAccount, requestingAccount, internal := extractFromCtx(ctx) - if internal { + activityContext := getActivityContext(ctx) + if activityContext.internal { return nil // Already processed. } + requestingAcct := activityContext.requestingAcct + receivingAcct := activityContext.receivingAcct + for _, obj := range ap.ExtractObjects(reject) { if obj.IsIRI() { @@ -59,13 +62,13 @@ func (f *federatingDB) Reject(ctx context.Context, reject vocab.ActivityStreamsR // Make sure the creator of the original follow // is the same as whatever inbox this landed in. - if followReq.AccountID != receivingAccount.ID { + if followReq.AccountID != receivingAcct.ID { return errors.New("Reject: follow account and inbox account were not the same") } // Make sure the target of the original follow // is the same as the account making the request. - if followReq.TargetAccountID != requestingAccount.ID { + if followReq.TargetAccountID != requestingAcct.ID { return errors.New("Reject: follow target account and requesting account were not the same") } @@ -89,13 +92,13 @@ func (f *federatingDB) Reject(ctx context.Context, reject vocab.ActivityStreamsR // Make sure the creator of the original follow // is the same as whatever inbox this landed in. - if gtsFollow.AccountID != receivingAccount.ID { + if gtsFollow.AccountID != receivingAcct.ID { return errors.New("Reject: follow account and inbox account were not the same") } // Make sure the target of the original follow // is the same as the account making the request. - if gtsFollow.TargetAccountID != requestingAccount.ID { + if gtsFollow.TargetAccountID != requestingAcct.ID { return errors.New("Reject: follow target account and requesting account were not the same") } |