diff options
author | zeripath <art27@cantab.net> | 2020-07-11 22:46:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-12 00:46:01 +0300 |
commit | 63591016b3ecd79ab1172cd98e2e830a09d6f515 (patch) | |
tree | 3e64ac14712959cd352c21c523e0bc69d153cf71 /models/notification.go | |
parent | d08996c7b962f686ce9528e14a65144dc3e5ec21 (diff) | |
download | gitea-63591016b3ecd79ab1172cd98e2e830a09d6f515.tar.gz gitea-63591016b3ecd79ab1172cd98e2e830a09d6f515.zip |
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 <art27@cantab.net>
* fix swagger
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix swagger again
Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix test
Signed-off-by: Andrew Thornton <art27@cantab.net>
* remove spurious debugs
* as per @6543
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update models/notification.go
* as per @6543
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/notification.go')
-rw-r--r-- | models/notification.go | 6 |
1 files changed, 3 insertions, 3 deletions
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}) |