Backport #12164 This PR extends the notifications API to allow specific notification statuses to be searched for and to allow setting of notifications to statuses other than read. By default unread and pinned statuses will be returned when querying for notifications - however pinned statuses will not be marked as read. Close #12152 Signed-off-by: Andrew Thornton art27@cantab.net
This commit is contained in:
parent
5e62137fe3
commit
489e9162fc
7 changed files with 206 additions and 24 deletions
|
@ -55,7 +55,7 @@ func TestAPINotification(t *testing.T) {
|
|||
assert.EqualValues(t, false, apiNL[2].Pinned)
|
||||
|
||||
// -- GET /repos/{owner}/{repo}/notifications --
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/notifications?token=%s", user2.Name, repo1.Name, token))
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/notifications?status-types=unread&token=%s", user2.Name, repo1.Name, token))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &apiNL)
|
||||
|
||||
|
@ -92,7 +92,7 @@ func TestAPINotification(t *testing.T) {
|
|||
assert.True(t, new.New > 0)
|
||||
|
||||
// -- mark notifications as read --
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications?token=%s", token))
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications?status-types=unread&token=%s", token))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &apiNL)
|
||||
assert.Len(t, apiNL, 2)
|
||||
|
@ -101,7 +101,7 @@ func TestAPINotification(t *testing.T) {
|
|||
req = NewRequest(t, "PUT", fmt.Sprintf("/api/v1/repos/%s/%s/notifications?last_read_at=%s&token=%s", user2.Name, repo1.Name, lastReadAt, token))
|
||||
resp = session.MakeRequest(t, req, http.StatusResetContent)
|
||||
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications?token=%s", token))
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications?status-types=unread&token=%s", token))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &apiNL)
|
||||
assert.Len(t, apiNL, 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue