diff options
author | 2023-06-13 16:47:56 +0200 | |
---|---|---|
committer | 2023-06-13 15:47:56 +0100 | |
commit | 24fbdf2b0a820684b69b10893e82cdb1a76ca14d (patch) | |
tree | d44a092d0bffb8159e4844bfaf4ef84a82f41e2e /internal/federation/federatingdb/update.go | |
parent | [docs] Add certificates and firewalling to advanced (#1888) (diff) | |
download | gotosocial-24fbdf2b0a820684b69b10893e82cdb1a76ca14d.tar.xz |
[chore] Refactor AP authentication, other small bits of tidying up (#1874)
Diffstat (limited to 'internal/federation/federatingdb/update.go')
-rw-r--r-- | internal/federation/federatingdb/update.go | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/internal/federation/federatingdb/update.go b/internal/federation/federatingdb/update.go index 5c8785c08..aad386085 100644 --- a/internal/federation/federatingdb/update.go +++ b/internal/federation/federatingdb/update.go @@ -52,28 +52,14 @@ func (f *federatingDB) Update(ctx context.Context, asType vocab.Type) error { l.Debug("entering Update") } - receivingAccount, _ := extractFromCtx(ctx) - if receivingAccount == nil { - // If the receiving account wasn't set on the context, that means - // this request didn't pass through the API, but came from inside - // GtS as the result of another activity on this instance. As such, - // we must have already processed it in order to reach this stage. - return nil - } - - requestingAcctI := ctx.Value(ap.ContextRequestingAccount) - if requestingAcctI == nil { - return errors.New("Update: requesting account wasn't set on context") - } - - requestingAcct, ok := requestingAcctI.(*gtsmodel.Account) - if !ok { - return errors.New("Update: requesting account was set on context but couldn't be parsed") + receivingAccount, requestingAccount, internal := extractFromCtx(ctx) + if internal { + return nil // Already processed. } switch asType.GetTypeName() { case ap.ActorApplication, ap.ActorGroup, ap.ActorOrganization, ap.ActorPerson, ap.ActorService: - return f.updateAccountable(ctx, receivingAccount, requestingAcct, asType) + return f.updateAccountable(ctx, receivingAccount, requestingAccount, asType) } return nil |