Update account name during displayName setting syncing
This commit is contained in:
parent
f25088483c
commit
83a6dbfa3e
|
@ -145,7 +145,7 @@ func (m *Messenger) handleBackedUpSettings(message *protobuf.SyncSetting) error
|
|||
return nil
|
||||
}
|
||||
|
||||
settingField, err := m.extractSyncSetting(message)
|
||||
settingField, err := m.extractAndSaveSyncSetting(message)
|
||||
if err != nil {
|
||||
m.logger.Warn("failed to handle SyncSetting from backed up message", zap.Error(err))
|
||||
return nil
|
||||
|
|
|
@ -1922,16 +1922,12 @@ func (m *Messenger) HandleRequestAddressForTransaction(messageState *ReceivedMes
|
|||
}
|
||||
|
||||
func (m *Messenger) handleSyncSetting(messageState *ReceivedMessageState, message *protobuf.SyncSetting) error {
|
||||
settingField, err := m.extractSyncSetting(message)
|
||||
settingField, err := m.extractAndSaveSyncSetting(message)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if message.GetType() == protobuf.SyncSetting_DISPLAY_NAME && settingField != nil {
|
||||
oldDisplayName, err := m.settings.DisplayName()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if oldDisplayName != message.GetValueString() {
|
||||
if m.account.Name != message.GetValueString() {
|
||||
m.account.Name = message.GetValueString()
|
||||
err = m.multiAccounts.SaveAccount(*m.account)
|
||||
if err != nil {
|
||||
|
|
|
@ -76,7 +76,7 @@ func (m *Messenger) syncSettings(rawMessageHandler RawMessageHandler) error {
|
|||
}
|
||||
|
||||
// extractSyncSetting parses incoming *protobuf.SyncSetting and stores the setting data if needed
|
||||
func (m *Messenger) extractSyncSetting(syncSetting *protobuf.SyncSetting) (*settings.SyncSettingField, error) {
|
||||
func (m *Messenger) extractAndSaveSyncSetting(syncSetting *protobuf.SyncSetting) (*settings.SyncSettingField, error) {
|
||||
sf, err := settings.GetFieldFromProtobufType(syncSetting.Type)
|
||||
if err != nil {
|
||||
m.logger.Error(
|
||||
|
|
Loading…
Reference in New Issue