mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-25 22:43:32 -06:00
Account update issue (#250)
* start poking around * tests * notes and fiddling
This commit is contained in:
parent
b3fd9c39a3
commit
b5a7e1ba32
5 changed files with 172 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue