mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 15:42:24 -05:00
[chore] refactor extractFromCtx a bit (#2646)
This commit is contained in:
parent
a41e8a95bf
commit
d3f35e8eba
8 changed files with 106 additions and 59 deletions
|
|
@ -53,17 +53,20 @@ func (f *federatingDB) Update(ctx context.Context, asType vocab.Type) error {
|
|||
l.Debug("entering Update")
|
||||
}
|
||||
|
||||
receivingAccount, requestingAccount, internal := extractFromCtx(ctx)
|
||||
if internal {
|
||||
activityContext := getActivityContext(ctx)
|
||||
if activityContext.internal {
|
||||
return nil // Already processed.
|
||||
}
|
||||
|
||||
requestingAcct := activityContext.requestingAcct
|
||||
receivingAcct := activityContext.receivingAcct
|
||||
|
||||
if accountable, ok := ap.ToAccountable(asType); ok {
|
||||
return f.updateAccountable(ctx, receivingAccount, requestingAccount, accountable)
|
||||
return f.updateAccountable(ctx, receivingAcct, requestingAcct, accountable)
|
||||
}
|
||||
|
||||
if statusable, ok := ap.ToStatusable(asType); ok {
|
||||
return f.updateStatusable(ctx, receivingAccount, requestingAccount, statusable)
|
||||
return f.updateStatusable(ctx, receivingAcct, requestingAcct, statusable)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue