From 64589fbd1f81022c7f995a7d993f0c026ecc6923 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 15 Dec 2021 10:34:20 +0200 Subject: [PATCH] Fetch synced_from and synced_to from db to avoid resetting values to zero --- VERSION | 2 +- protocol/persistence.go | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index fe37babed..96a3f9621 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.92.4 +0.92.5 diff --git a/protocol/persistence.go b/protocol/persistence.go index c3f869020..57dab1290 100644 --- a/protocol/persistence.go +++ b/protocol/persistence.go @@ -367,6 +367,8 @@ func (db sqlitePersistence) Chat(chatID string) (*Chat, error) { lastMessageBytes []byte invitationAdmin sql.NullString profile sql.NullString + syncedFrom sql.NullInt64 + syncedTo sql.NullInt64 ) err := db.db.QueryRow(` @@ -393,7 +395,9 @@ func (db sqlitePersistence) Chat(chatID string) (*Chat, error) { joined, description, highlight, - received_invitation_admin + received_invitation_admin, + synced_from, + synced_to FROM chats WHERE id = ? `, chatID).Scan(&chat.ID, @@ -419,11 +423,19 @@ func (db sqlitePersistence) Chat(chatID string) (*Chat, error) { &chat.Description, &chat.Highlight, &chat.ReceivedInvitationAdmin, + &syncedFrom, + &syncedTo, ) switch err { case sql.ErrNoRows: return nil, nil case nil: + if syncedFrom.Valid { + chat.SyncedFrom = uint32(syncedFrom.Int64) + } + if syncedTo.Valid { + chat.SyncedTo = uint32(syncedTo.Int64) + } if invitationAdmin.Valid { chat.InvitationAdmin = invitationAdmin.String }