diff --git a/VERSION b/VERSION index 95fce8ca2..359d7a7da 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.98.0 +0.98.1 diff --git a/protocol/activity_center_persistence.go b/protocol/activity_center_persistence.go index 23f7df789..83d26b48c 100644 --- a/protocol/activity_center_persistence.go +++ b/protocol/activity_center_persistence.go @@ -425,6 +425,11 @@ func (db sqlitePersistence) DismissAllActivityCenterNotificationsFromCommunity(c } +func (db sqlitePersistence) DismissAllActivityCenterNotificationsFromChatID(chatID string) error { + _, err := db.db.Exec(`UPDATE activity_center_notifications SET read = 1, dismissed = 1 WHERE NOT dismissed AND NOT accepted AND chat_id = ?`, chatID) + return err +} + func (db sqlitePersistence) AcceptAllActivityCenterNotifications() ([]*ActivityCenterNotification, error) { var tx *sql.Tx var err error diff --git a/protocol/messenger.go b/protocol/messenger.go index 3e3f79e35..c9ca19789 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -2091,6 +2091,11 @@ func (m *Messenger) leaveGroupChat(ctx context.Context, response *MessengerRespo } func (m *Messenger) LeaveGroupChat(ctx context.Context, chatID string, remove bool) (*MessengerResponse, error) { + err := m.persistence.DismissAllActivityCenterNotificationsFromChatID(chatID) + if err != nil { + return nil, err + } + var response MessengerResponse return m.leaveGroupChat(ctx, &response, chatID, remove, true) } @@ -4070,6 +4075,11 @@ func (m *Messenger) markAllRead(chatID string, clock uint64, shouldBeSynced bool } func (m *Messenger) MarkAllRead(chatID string) error { + err := m.persistence.DismissAllActivityCenterNotificationsFromChatID(chatID) + if err != nil { + return err + } + chat, ok := m.allChats.Load(chatID) if !ok { return errors.New("chat not found")