summaryrefslogtreecommitdiff
path: root/internal/db/bundb/notification.go
diff options
context:
space:
mode:
authorLibravatar Artémis <diane@artemix.org>2022-08-01 11:13:49 +0200
committerLibravatar GitHub <noreply@github.com>2022-08-01 11:13:49 +0200
commit4fdbef04b4ae41e6193d4f4416c83edf91e1bfb7 (patch)
treef28b7d40c38ee6b83ae5ff386cf25dc55ed0e157 /internal/db/bundb/notification.go
parentserve HEAD requests via the fileserver (#735) (diff)
downloadgotosocial-4fdbef04b4ae41e6193d4f4416c83edf91e1bfb7.tar.xz
[feature] Implemented notification clear (#720)
* Implemented notification clear * Added the cache clear mechanism * added multi user check test
Diffstat (limited to 'internal/db/bundb/notification.go')
-rw-r--r--internal/db/bundb/notification.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/db/bundb/notification.go b/internal/db/bundb/notification.go
index 5e825d096..034b3b8ec 100644
--- a/internal/db/bundb/notification.go
+++ b/internal/db/bundb/notification.go
@@ -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
+}