Save access token when enabling double puppeting manually. Fixes #5

This commit is contained in:
Tulir Asokan 2023-08-02 15:14:45 +03:00
parent b958401b73
commit bef980092f

View file

@ -42,7 +42,15 @@ func (user *User) SwitchCustomMXID(accessToken string, mxid id.UserID) error {
}
user.DoublePuppetIntent = nil
user.AccessToken = accessToken
return user.startCustomMXID(false)
err := user.startCustomMXID(false)
if err != nil {
return err
}
err = user.Update(context.TODO())
if err != nil {
return fmt.Errorf("failed to save access token to database: %w", err)
}
return nil
}
func (user *User) CustomIntent() *appservice.IntentAPI {