Dismiss activity center notifications of group on leave or Mark read
This commit is contained in:
parent
14ed8ba5e8
commit
3050106595
|
@ -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) {
|
func (db sqlitePersistence) AcceptAllActivityCenterNotifications() ([]*ActivityCenterNotification, error) {
|
||||||
var tx *sql.Tx
|
var tx *sql.Tx
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -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) {
|
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
|
var response MessengerResponse
|
||||||
return m.leaveGroupChat(ctx, &response, chatID, remove, true)
|
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 {
|
func (m *Messenger) MarkAllRead(chatID string) error {
|
||||||
|
err := m.persistence.DismissAllActivityCenterNotificationsFromChatID(chatID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
chat, ok := m.allChats.Load(chatID)
|
chat, ok := m.allChats.Load(chatID)
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("chat not found")
|
return errors.New("chat not found")
|
||||||
|
|
Loading…
Reference in New Issue