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/delete.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/delete.go')
-rw-r--r-- | internal/federation/federatingdb/delete.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/federation/federatingdb/delete.go b/internal/federation/federatingdb/delete.go index cca5fdcad..7390cf0f5 100644 --- a/internal/federation/federatingdb/delete.go +++ b/internal/federation/federatingdb/delete.go @@ -40,30 +40,33 @@ func (f *federatingDB) Delete(ctx context.Context, id *url.URL) error { }...) l.Debug("entering Delete") - receivingAccount, requestingAccount, internal := extractFromCtx(ctx) - if internal { + activityContext := getActivityContext(ctx) + if activityContext.internal { return nil // Already processed. } + requestingAcct := activityContext.requestingAcct + receivingAcct := activityContext.receivingAcct + // in a delete we only get the URI, we can't know if we have a status or a profile or something else, // so we have to try a few different things... - if s, err := f.state.DB.GetStatusByURI(ctx, id.String()); err == nil && requestingAccount.ID == s.AccountID { + if s, err := f.state.DB.GetStatusByURI(ctx, id.String()); err == nil && requestingAcct.ID == s.AccountID { l.Debugf("uri is for STATUS with id: %s", s.ID) f.state.Workers.EnqueueFediAPI(ctx, messages.FromFediAPI{ APObjectType: ap.ObjectNote, APActivityType: ap.ActivityDelete, GTSModel: s, - ReceivingAccount: receivingAccount, + ReceivingAccount: receivingAcct, }) } - if a, err := f.state.DB.GetAccountByURI(ctx, id.String()); err == nil && requestingAccount.ID == a.ID { + if a, err := f.state.DB.GetAccountByURI(ctx, id.String()); err == nil && requestingAcct.ID == a.ID { l.Debugf("uri is for ACCOUNT with id %s", a.ID) f.state.Workers.EnqueueFediAPI(ctx, messages.FromFediAPI{ APObjectType: ap.ObjectProfile, APActivityType: ap.ActivityDelete, GTSModel: a, - ReceivingAccount: receivingAccount, + ReceivingAccount: receivingAcct, }) } |