From 63591016b3ecd79ab1172cd98e2e830a09d6f515 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sat, 11 Jul 2020 22:46:01 +0100 Subject: Extend Notifications API and return pinned notifications by default (#12164) * Extend notifications API and return pinned notifications in notifications list Signed-off-by: Andrew Thornton * fix swagger Signed-off-by: Andrew Thornton * Fix swagger again Signed-off-by: Andrew Thornton * fix test Signed-off-by: Andrew Thornton * remove spurious debugs * as per @6543 Signed-off-by: Andrew Thornton * Update models/notification.go * as per @6543 Signed-off-by: Andrew Thornton Co-authored-by: techknowlogick --- models/notification.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'models/notification.go') diff --git a/models/notification.go b/models/notification.go index 1c378a1350..9258b68f22 100644 --- a/models/notification.go +++ b/models/notification.go @@ -72,7 +72,7 @@ type FindNotificationOptions struct { UserID int64 RepoID int64 IssueID int64 - Status NotificationStatus + Status []NotificationStatus UpdatedAfterUnix int64 UpdatedBeforeUnix int64 } @@ -89,8 +89,8 @@ func (opts *FindNotificationOptions) ToCond() builder.Cond { if opts.IssueID != 0 { cond = cond.And(builder.Eq{"notification.issue_id": opts.IssueID}) } - if opts.Status != 0 { - cond = cond.And(builder.Eq{"notification.status": opts.Status}) + if len(opts.Status) > 0 { + cond = cond.And(builder.In("notification.status", opts.Status)) } if opts.UpdatedAfterUnix != 0 { cond = cond.And(builder.Gte{"notification.updated_unix": opts.UpdatedAfterUnix}) -- cgit v1.2.3