diff options
author | 2021-09-28 15:21:59 +0200 | |
---|---|---|
committer | 2021-09-28 15:21:59 +0200 | |
commit | b5a7e1ba323a2493873dedf3a3835c2e9564cb24 (patch) | |
tree | baf6b49256ffc319dafa35289ee13de5f9fbb516 /internal/federation/federatingdb/update.go | |
parent | Weird notif issue (#248) (diff) | |
download | gotosocial-b5a7e1ba323a2493873dedf3a3835c2e9564cb24.tar.xz |
Account update issue (#250)
* start poking around
* tests
* notes and fiddling
Diffstat (limited to 'internal/federation/federatingdb/update.go')
-rw-r--r-- | internal/federation/federatingdb/update.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/federation/federatingdb/update.go b/internal/federation/federatingdb/update.go index 2bcf2533c..5dec2bd69 100644 --- a/internal/federation/federatingdb/update.go +++ b/internal/federation/federatingdb/update.go @@ -98,8 +98,7 @@ func (f *federatingDB) Update(ctx context.Context, asType vocab.Type) error { typeName == ap.ActorService { // it's an UPDATE to some kind of account var accountable ap.Accountable - - switch asType.GetTypeName() { + switch typeName { case ap.ActorApplication: l.Debug("got update for APPLICATION") i, ok := asType.(vocab.ActivityStreamsApplication) @@ -152,19 +151,24 @@ func (f *federatingDB) Update(ctx context.Context, asType vocab.Type) error { return fmt.Errorf("UPDATE: update for account %s was requested by account %s, this is not valid", updatedAcct.URI, requestingAcct.URI) } - updatedAcct.ID = requestingAcct.ID // set this here so the db will update properly instead of trying to PUT this and getting constraint issues + // set some fields here on the updatedAccount representation so we don't run into db issues + updatedAcct.CreatedAt = requestingAcct.CreatedAt + updatedAcct.ID = requestingAcct.ID + updatedAcct.Language = requestingAcct.Language + + // do the update updatedAcct, err = f.db.UpdateAccount(ctx, updatedAcct) if err != nil { return fmt.Errorf("UPDATE: database error inserting updated account: %s", err) } + // pass to the processor for further processing of eg., avatar/header fromFederatorChan <- messages.FromFederator{ APObjectType: ap.ObjectProfile, APActivityType: ap.ActivityUpdate, GTSModel: updatedAcct, ReceivingAccount: targetAcct, } - } return nil |