mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-29 04:22:24 -05:00 
			
		
		
		
	[bugfix] Update account Update logic (#1984)
		
	This commit is contained in:
		
					parent
					
						
							
								8d92b2479f
							
						
					
				
			
			
				commit
				
					
						1951e6c840
					
				
			
		
					 3 changed files with 94 additions and 75 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue