mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 10:47:29 -06:00
[feature] Implemented notification clear (#720)
* Implemented notification clear * Added the cache clear mechanism * added multi user check test
This commit is contained in:
parent
8fdc9ed552
commit
4fdbef04b4
7 changed files with 109 additions and 1 deletions
|
|
@ -108,3 +108,17 @@ func (n *notificationDB) GetNotifications(ctx context.Context, accountID string,
|
|||
|
||||
return notifs, nil
|
||||
}
|
||||
|
||||
func (n *notificationDB) ClearNotifications(ctx context.Context, accountID string) db.Error {
|
||||
if _, err := n.conn.
|
||||
NewDelete().
|
||||
Table("notifications").
|
||||
Where("target_account_id = ?", accountID).
|
||||
Exec(ctx); err != nil {
|
||||
return n.conn.ProcessError(err)
|
||||
}
|
||||
|
||||
n.cache.Clear()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue