mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 01:34:27 +00:00 
			
		
		
		
	API: NotificationSubject show Issue/Pull State (#12901)
This commit is contained in:
		@@ -354,6 +354,7 @@ func (n *Notification) APIFormat() *api.NotificationThread {
 | 
				
			|||||||
		if n.Issue != nil {
 | 
							if n.Issue != nil {
 | 
				
			||||||
			result.Subject.Title = n.Issue.Title
 | 
								result.Subject.Title = n.Issue.Title
 | 
				
			||||||
			result.Subject.URL = n.Issue.APIURL()
 | 
								result.Subject.URL = n.Issue.APIURL()
 | 
				
			||||||
 | 
								result.Subject.State = n.Issue.State()
 | 
				
			||||||
			comment, err := n.Issue.GetLastComment()
 | 
								comment, err := n.Issue.GetLastComment()
 | 
				
			||||||
			if err == nil && comment != nil {
 | 
								if err == nil && comment != nil {
 | 
				
			||||||
				result.Subject.LatestCommentURL = comment.APIURL()
 | 
									result.Subject.LatestCommentURL = comment.APIURL()
 | 
				
			||||||
@@ -364,6 +365,7 @@ func (n *Notification) APIFormat() *api.NotificationThread {
 | 
				
			|||||||
		if n.Issue != nil {
 | 
							if n.Issue != nil {
 | 
				
			||||||
			result.Subject.Title = n.Issue.Title
 | 
								result.Subject.Title = n.Issue.Title
 | 
				
			||||||
			result.Subject.URL = n.Issue.APIURL()
 | 
								result.Subject.URL = n.Issue.APIURL()
 | 
				
			||||||
 | 
								result.Subject.State = n.Issue.State()
 | 
				
			||||||
			comment, err := n.Issue.GetLastComment()
 | 
								comment, err := n.Issue.GetLastComment()
 | 
				
			||||||
			if err == nil && comment != nil {
 | 
								if err == nil && comment != nil {
 | 
				
			||||||
				result.Subject.LatestCommentURL = comment.APIURL()
 | 
									result.Subject.LatestCommentURL = comment.APIURL()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,10 +21,11 @@ type NotificationThread struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// NotificationSubject contains the notification subject (Issue/Pull/Commit)
 | 
					// NotificationSubject contains the notification subject (Issue/Pull/Commit)
 | 
				
			||||||
type NotificationSubject struct {
 | 
					type NotificationSubject struct {
 | 
				
			||||||
	Title            string `json:"title"`
 | 
						Title            string    `json:"title"`
 | 
				
			||||||
	URL              string `json:"url"`
 | 
						URL              string    `json:"url"`
 | 
				
			||||||
	LatestCommentURL string `json:"latest_comment_url"`
 | 
						LatestCommentURL string    `json:"latest_comment_url"`
 | 
				
			||||||
	Type             string `json:"type" binding:"In(Issue,Pull,Commit)"`
 | 
						Type             string    `json:"type" binding:"In(Issue,Pull,Commit)"`
 | 
				
			||||||
 | 
						State            StateType `json:"state"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NotificationCount number of unread notifications
 | 
					// NotificationCount number of unread notifications
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13835,6 +13835,9 @@
 | 
				
			|||||||
          "type": "string",
 | 
					          "type": "string",
 | 
				
			||||||
          "x-go-name": "LatestCommentURL"
 | 
					          "x-go-name": "LatestCommentURL"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        "state": {
 | 
				
			||||||
 | 
					          "$ref": "#/definitions/StateType"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        "title": {
 | 
					        "title": {
 | 
				
			||||||
          "type": "string",
 | 
					          "type": "string",
 | 
				
			||||||
          "x-go-name": "Title"
 | 
					          "x-go-name": "Title"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user