Fix activity notification delition on message delition

This commit is contained in:
Roman Volosovskyi 2022-09-12 15:39:07 +02:00
parent 5b0d8a7c4e
commit 6f93913be5
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
3 changed files with 9 additions and 1 deletions

View File

@ -1 +1 @@
0.109.3 0.109.4

View File

@ -43,6 +43,10 @@ func (db sqlitePersistence) DeleteActivityCenterNotificationForMessage(chatID st
var ids []types.HexBytes var ids []types.HexBytes
for _, notification := range notifications { for _, notification := range notifications {
if notification.LastMessage != nil && notification.LastMessage.ID == messageID {
ids = append(ids, notification.ID)
}
if notification.Message != nil && notification.Message.ID == messageID { if notification.Message != nil && notification.Message.ID == messageID {
ids = append(ids, notification.ID) ids = append(ids, notification.ID)
} }

View File

@ -1167,6 +1167,10 @@ func (m *Messenger) HandleDeleteMessage(state *ReceivedMessageState, deleteMessa
if err := m.updateLastMessage(chat); err != nil { if err := m.updateLastMessage(chat); err != nil {
return err return err
} }
if chat.LastMessage != nil && chat.LastMessage.Seen == false && chat.OneToOne() && !chat.Active {
m.createMessageNotification(chat, state)
}
} }
state.Response.AddRemovedMessage(&RemovedMessage{MessageID: messageID, ChatID: chat.ID}) state.Response.AddRemovedMessage(&RemovedMessage{MessageID: messageID, ChatID: chat.ID})