diff options
author | 2023-07-12 13:20:15 +0200 | |
---|---|---|
committer | 2023-07-12 12:20:15 +0100 | |
commit | 1951e6c84085fae11d4f0699b3b268df273cef02 (patch) | |
tree | cd2a9593fbae9cc58183d32f0f9b6a9f748a9ac4 /internal/processing/fromfederator.go | |
parent | [bugfix] Align default values in the configuration file with the code (#1971) (diff) | |
download | gotosocial-1951e6c84085fae11d4f0699b3b268df273cef02.tar.xz |
[bugfix] Update account `Update` logic (#1984)
Diffstat (limited to 'internal/processing/fromfederator.go')
-rw-r--r-- | internal/processing/fromfederator.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/processing/fromfederator.go b/internal/processing/fromfederator.go index 52b12126c..abe292cae 100644 --- a/internal/processing/fromfederator.go +++ b/internal/processing/fromfederator.go @@ -20,7 +20,6 @@ package processing import ( "context" "errors" - "fmt" "net/url" "codeberg.org/gruf/go-kv" @@ -422,27 +421,28 @@ func (p *Processor) processCreateFlagFromFederator(ctx context.Context, federato // processUpdateAccountFromFederator handles Activity Update and Object Profile func (p *Processor) processUpdateAccountFromFederator(ctx context.Context, federatorMsg messages.FromFederator) error { - incomingAccount, ok := federatorMsg.GTSModel.(*gtsmodel.Account) + // Parse the old/existing account model. + account, ok := federatorMsg.GTSModel.(*gtsmodel.Account) if !ok { - return errors.New("*gtsmodel.Account was not parseable on update account message") + return gtserror.New("account was not parseable as *gtsmodel.Account") } - // Because this was an Update, the new AP Object should be set on the message. - incomingAccountable, ok := federatorMsg.APObjectModel.(ap.Accountable) + // Because this was an Update, the new Accountable should be set on the message. + apubAcc, ok := federatorMsg.APObjectModel.(ap.Accountable) if !ok { - return errors.New("Accountable was not parseable on update account message") + return gtserror.New("Accountable was not parseable on update account message") } // Fetch up-to-date bio, avatar, header, etc. _, _, err := p.federator.RefreshAccount( ctx, federatorMsg.ReceivingAccount.Username, - incomingAccount, - incomingAccountable, - true, + account, + apubAcc, + true, // Force refresh. ) if err != nil { - return fmt.Errorf("error enriching updated account from federator: %s", err) + return gtserror.Newf("error refreshing updated account: %w", err) } return nil |