From 3837428384a07312e64d08a38a01efa68200f4f1 Mon Sep 17 00:00:00 2001 From: frank Date: Fri, 25 Aug 2023 22:28:26 +0800 Subject: [PATCH] =?UTF-8?q?continue=20process=20after=20`SaveSyncDisplayNa?= =?UTF-8?q?me`=20get=20`ErrNewClockOlderTha=E2=80=A6=20(#3952)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * continue process after `SaveSyncDisplayName` get `ErrNewClockOlderThanCurrent` * bump version --- VERSION | 2 +- protocol/messenger_backup_handler.go | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 1afa2d4f3..0099ed871 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.165.1 +0.165.2 diff --git a/protocol/messenger_backup_handler.go b/protocol/messenger_backup_handler.go index 40d58b0ec..07f4e5726 100644 --- a/protocol/messenger_backup_handler.go +++ b/protocol/messenger_backup_handler.go @@ -3,16 +3,15 @@ package protocol import ( "database/sql" - ensservice "github.com/status-im/status-go/services/ens" - - "github.com/status-im/status-go/protocol/identity" - v1protocol "github.com/status-im/status-go/protocol/v1" - "go.uber.org/zap" "github.com/status-im/status-go/images" + "github.com/status-im/status-go/multiaccounts/errors" + "github.com/status-im/status-go/protocol/identity" "github.com/status-im/status-go/protocol/protobuf" + v1protocol "github.com/status-im/status-go/protocol/v1" "github.com/status-im/status-go/protocol/wakusync" + ensservice "github.com/status-im/status-go/services/ens" ) const ( @@ -106,12 +105,17 @@ func (m *Messenger) handleBackedUpProfile(message *protobuf.BackedUpProfile, bac } err := m.SaveSyncDisplayName(message.DisplayName, message.DisplayNameClock) - if err != nil { + if err != nil && err != errors.ErrNewClockOlderThanCurrent { return err } response.SetDisplayName(message.DisplayName) + // if we already have a newer clock, then we don't need to update the display name + if err == errors.ErrNewClockOlderThanCurrent { + response.SetDisplayName(m.account.Name) + } + syncWithBackedUpImages := false dbImages, err := m.multiAccounts.GetIdentityImages(message.KeyUid) if err != nil {