diff --git a/multiaccounts/database.go b/multiaccounts/database.go index c259e5985..ab6892e04 100644 --- a/multiaccounts/database.go +++ b/multiaccounts/database.go @@ -344,9 +344,8 @@ func (db *Database) UpdateAccountTimestamp(keyUID string, loginTimestamp int64) return err } -func (db *Database) UpdateAccountCustomizationColor(keyUID string, color string, clock uint64) error { - _, err := db.db.Exec("UPDATE accounts SET customizationColor = ?, customizationColorClock = ? WHERE keyUid = ? AND customizationColorClock < ?", color, clock, keyUID, clock) - return err +func (db *Database) UpdateAccountCustomizationColor(keyUID string, color string, clock uint64) (sql.Result, error) { + return db.db.Exec("UPDATE accounts SET customizationColor = ?, customizationColorClock = ? WHERE keyUid = ? AND customizationColorClock < ?", color, clock, keyUID, clock) } func (db *Database) DeleteAccount(keyUID string) error { diff --git a/protocol/messenger_handler.go b/protocol/messenger_handler.go index 74948f18e..204142cfa 100644 --- a/protocol/messenger_handler.go +++ b/protocol/messenger_handler.go @@ -2415,12 +2415,18 @@ func (m *Messenger) HandleSyncSetting(messageState *ReceivedMessageState, messag } func (m *Messenger) HandleSyncAccountCustomizationColor(state *ReceivedMessageState, message *protobuf.SyncAccountCustomizationColor, statusMessage *v1protocol.StatusMessage) error { - err := m.multiAccounts.UpdateAccountCustomizationColor(message.GetKeyUid(), message.GetCustomizationColor(), message.GetUpdatedAt()) + result, err := m.multiAccounts.UpdateAccountCustomizationColor(message.GetKeyUid(), message.GetCustomizationColor(), message.GetUpdatedAt()) if err != nil { return err } - state.Response.CustomizationColor = message.GetCustomizationColor() + affected, err := result.RowsAffected() + if err != nil { + return err + } + if affected > 0 { + state.Response.CustomizationColor = message.GetCustomizationColor() + } return nil }