summaryrefslogtreecommitdiff
path: root/internal/db/bundb/notification.go
diff options
context:
space:
mode:
authorLibravatar Blackle Morisanchetto <isabelle@blackle-mori.com>2022-08-31 13:20:52 -0400
committerLibravatar GitHub <noreply@github.com>2022-08-31 19:20:52 +0200
commitecb97f4e0bae0735464880cd850e964f292f2e92 (patch)
treec0c6c6576beaf1e4a0bbd740d8db9341d77b2ae6 /internal/db/bundb/notification.go
parent[bugfix] Use custom blackfriday renderer to only add mention/hashtag links in... (diff)
downloadgotosocial-ecb97f4e0bae0735464880cd850e964f292f2e92.tar.xz
[feature] Add support for the exclude_types[] parameter on the notifications endpoint (#784)
* Add support for the exclude_types[] parameter on the notifications endpoint * Add swagger docs to notifications
Diffstat (limited to 'internal/db/bundb/notification.go')
-rw-r--r--internal/db/bundb/notification.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/db/bundb/notification.go b/internal/db/bundb/notification.go
index 034b3b8ec..32523ca24 100644
--- a/internal/db/bundb/notification.go
+++ b/internal/db/bundb/notification.go
@@ -56,7 +56,7 @@ func (n *notificationDB) GetNotification(ctx context.Context, id string) (*gtsmo
return &dst, nil
}
-func (n *notificationDB) GetNotifications(ctx context.Context, accountID string, limit int, maxID string, sinceID string) ([]*gtsmodel.Notification, db.Error) {
+func (n *notificationDB) GetNotifications(ctx context.Context, accountID string, excludeTypes []string, limit int, maxID string, sinceID string) ([]*gtsmodel.Notification, db.Error) {
// Ensure reasonable
if limit < 0 {
limit = 0
@@ -78,6 +78,10 @@ func (n *notificationDB) GetNotifications(ctx context.Context, accountID string,
q = q.Where("id > ?", sinceID)
}
+ for _, excludeType := range excludeTypes {
+ q = q.Where("notification_type != ?", excludeType)
+ }
+
q = q.
Where("target_account_id = ?", accountID).
Order("id DESC")