Browse Source

API: NotificationSubject show Issue/Pull State (#12901)

master
6543 3 years ago
committed by GitHub
parent
commit
2dbca92a0f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions
  1. +2
    -0
      models/notification.go
  2. +5
    -4
      modules/structs/notifications.go
  3. +3
    -0
      templates/swagger/v1_json.tmpl

+ 2
- 0
models/notification.go View File

@ -354,6 +354,7 @@ func (n *Notification) APIFormat() *api.NotificationThread {
if n.Issue != nil {
result.Subject.Title = n.Issue.Title
result.Subject.URL = n.Issue.APIURL()
result.Subject.State = n.Issue.State()
comment, err := n.Issue.GetLastComment()
if err == nil && comment != nil {
result.Subject.LatestCommentURL = comment.APIURL()
@ -364,6 +365,7 @@ func (n *Notification) APIFormat() *api.NotificationThread {
if n.Issue != nil {
result.Subject.Title = n.Issue.Title
result.Subject.URL = n.Issue.APIURL()
result.Subject.State = n.Issue.State()
comment, err := n.Issue.GetLastComment()
if err == nil && comment != nil {
result.Subject.LatestCommentURL = comment.APIURL()

+ 5
- 4
modules/structs/notifications.go View File

@ -21,10 +21,11 @@ type NotificationThread struct {
// NotificationSubject contains the notification subject (Issue/Pull/Commit)
type NotificationSubject struct {
Title string `json:"title"`
URL string `json:"url"`
LatestCommentURL string `json:"latest_comment_url"`
Type string `json:"type" binding:"In(Issue,Pull,Commit)"`
Title string `json:"title"`
URL string `json:"url"`
LatestCommentURL string `json:"latest_comment_url"`
Type string `json:"type" binding:"In(Issue,Pull,Commit)"`
State StateType `json:"state"`
}
// NotificationCount number of unread notifications

+ 3
- 0
templates/swagger/v1_json.tmpl View File

@ -13835,6 +13835,9 @@
"type": "string",
"x-go-name": "LatestCommentURL"
},
"state": {
"$ref": "#/definitions/StateType"
},
"title": {
"type": "string",
"x-go-name": "Title"

Loading…
Cancel
Save