Update chat clock on group event

This commit is contained in:
Roman Volosovskyi 2023-01-10 18:47:10 +01:00
parent fe9996d95f
commit d60c1d00ed
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 11 additions and 1 deletions

View File

@ -1 +1 @@
0.122.0
0.122.1

View File

@ -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 {