fix: set display name issue (#4642)
This commit is contained in:
parent
f31808d938
commit
9879b1ea77
|
@ -320,6 +320,11 @@ func (db *Database) SaveAccount(account Account) error {
|
|||
return db.StoreIdentityImages(account.KeyUID, account.Images, false)
|
||||
}
|
||||
|
||||
func (db *Database) UpdateDisplayName(keyUID string, displayName string) error {
|
||||
_, err := db.db.Exec("UPDATE accounts SET name = ? WHERE keyUid = ?", displayName, keyUID)
|
||||
return err
|
||||
}
|
||||
|
||||
func (db *Database) UpdateAccount(account Account) error {
|
||||
colorHash, err := json.Marshal(account.ColorHash)
|
||||
if err != nil {
|
||||
|
|
|
@ -67,7 +67,7 @@ func (m *Messenger) SetDisplayName(displayName string) error {
|
|||
}
|
||||
|
||||
m.account.Name = displayName
|
||||
err = m.multiAccounts.SaveAccount(*m.account)
|
||||
err = m.multiAccounts.UpdateDisplayName(m.account.KeyUID, displayName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -42,6 +42,9 @@ func (s *MessengerProfileDisplayNameHandlerSuite) TestDisplayNameChange() {
|
|||
s.Require().NoError(err)
|
||||
s.Require().True(accounts.SameKeypairs(profileKp, dbProfileKp))
|
||||
|
||||
// save account will create the account
|
||||
err = s.m.multiAccounts.SaveAccount(*s.m.account)
|
||||
s.Require().NoError(err)
|
||||
// set new display name
|
||||
err = s.m.SetDisplayName(testDisplayName)
|
||||
s.Require().NoError(err)
|
||||
|
|
Loading…
Reference in New Issue