mirror of
https://github.com/status-im/status-go.git
synced 2025-02-16 16:56:53 +00:00
fix: return CustomizationColor only on db rows affected (#4593)
This commit is contained in:
parent
926f6a3c72
commit
81f4c86086
@ -344,9 +344,8 @@ func (db *Database) UpdateAccountTimestamp(keyUID string, loginTimestamp int64)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *Database) UpdateAccountCustomizationColor(keyUID string, color string, clock uint64) error {
|
func (db *Database) UpdateAccountCustomizationColor(keyUID string, color string, clock uint64) (sql.Result, error) {
|
||||||
_, err := db.db.Exec("UPDATE accounts SET customizationColor = ?, customizationColorClock = ? WHERE keyUid = ? AND customizationColorClock < ?", color, clock, keyUID, clock)
|
return db.db.Exec("UPDATE accounts SET customizationColor = ?, customizationColorClock = ? WHERE keyUid = ? AND customizationColorClock < ?", color, clock, keyUID, clock)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *Database) DeleteAccount(keyUID string) error {
|
func (db *Database) DeleteAccount(keyUID string) error {
|
||||||
|
@ -2415,12 +2415,18 @@ func (m *Messenger) HandleSyncSetting(messageState *ReceivedMessageState, messag
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Messenger) HandleSyncAccountCustomizationColor(state *ReceivedMessageState, message *protobuf.SyncAccountCustomizationColor, statusMessage *v1protocol.StatusMessage) error {
|
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 {
|
if err != nil {
|
||||||
return err
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user