Skip to content

Commit 2dbca92

Browse files
authored
API: NotificationSubject show Issue/Pull State (#12901)
1 parent 3f9eb93 commit 2dbca92

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

models/notification.go

+2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ func (n *Notification) APIFormat() *api.NotificationThread {
354354
if n.Issue != nil {
355355
result.Subject.Title = n.Issue.Title
356356
result.Subject.URL = n.Issue.APIURL()
357+
result.Subject.State = n.Issue.State()
357358
comment, err := n.Issue.GetLastComment()
358359
if err == nil && comment != nil {
359360
result.Subject.LatestCommentURL = comment.APIURL()
@@ -364,6 +365,7 @@ func (n *Notification) APIFormat() *api.NotificationThread {
364365
if n.Issue != nil {
365366
result.Subject.Title = n.Issue.Title
366367
result.Subject.URL = n.Issue.APIURL()
368+
result.Subject.State = n.Issue.State()
367369
comment, err := n.Issue.GetLastComment()
368370
if err == nil && comment != nil {
369371
result.Subject.LatestCommentURL = comment.APIURL()

modules/structs/notifications.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ type NotificationThread struct {
2121

2222
// NotificationSubject contains the notification subject (Issue/Pull/Commit)
2323
type NotificationSubject struct {
24-
Title string `json:"title"`
25-
URL string `json:"url"`
26-
LatestCommentURL string `json:"latest_comment_url"`
27-
Type string `json:"type" binding:"In(Issue,Pull,Commit)"`
24+
Title string `json:"title"`
25+
URL string `json:"url"`
26+
LatestCommentURL string `json:"latest_comment_url"`
27+
Type string `json:"type" binding:"In(Issue,Pull,Commit)"`
28+
State StateType `json:"state"`
2829
}
2930

3031
// NotificationCount number of unread notifications

templates/swagger/v1_json.tmpl

+3
Original file line numberDiff line numberDiff line change
@@ -13835,6 +13835,9 @@
1383513835
"type": "string",
1383613836
"x-go-name": "LatestCommentURL"
1383713837
},
13838+
"state": {
13839+
"$ref": "#/definitions/StateType"
13840+
},
1383813841
"title": {
1383913842
"type": "string",
1384013843
"x-go-name": "Title"

0 commit comments

Comments
 (0)