From d60c1d00ed93d4340ab06a32ce062dd7e67e67c0 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Tue, 10 Jan 2023 18:47:10 +0100 Subject: [PATCH] Update chat clock on group event --- VERSION | 2 +- protocol/messenger_handler.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ee1e4d2ae..8fae20ec3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.122.0 +0.122.1 diff --git a/protocol/messenger_handler.go b/protocol/messenger_handler.go index d62ff158d..3e313859d 100644 --- a/protocol/messenger_handler.go +++ b/protocol/messenger_handler.go @@ -160,6 +160,16 @@ func (m *Messenger) HandleMembershipUpdate(messageState *ReceivedMessageState, c // Show push notifications when our key is added to members list and chat is Active showPushNotification = showPushNotification && wasUserAdded } + maxClockVal := uint64(0) + for _, event := range group.Events() { + if event.ClockValue > maxClockVal { + maxClockVal = event.ClockValue + } + } + + if chat.LastClockValue < maxClockVal { + chat.LastClockValue = maxClockVal + } // Only create a message notification when the user is added, not when removed if !chat.Active && wasUserAdded {