|
|
@ -31,10 +31,12 @@ func ToNotificationThread(n *models.Notification) *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.HTMLURL = n.Issue.HTMLURL() |
|
|
|
result.Subject.State = n.Issue.State() |
|
|
|
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() |
|
|
|
|
|
|
|
result.Subject.LatestCommentHTMLURL = comment.HTMLURL() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case models.NotificationSourcePullRequest: |
|
|
|
case models.NotificationSourcePullRequest: |
|
|
@ -42,10 +44,12 @@ func ToNotificationThread(n *models.Notification) *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.HTMLURL = n.Issue.HTMLURL() |
|
|
|
result.Subject.State = n.Issue.State() |
|
|
|
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() |
|
|
|
|
|
|
|
result.Subject.LatestCommentHTMLURL = comment.HTMLURL() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pr, _ := n.Issue.GetPullRequest() |
|
|
|
pr, _ := n.Issue.GetPullRequest() |
|
|
@ -54,16 +58,20 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case models.NotificationSourceCommit: |
|
|
|
case models.NotificationSourceCommit: |
|
|
|
|
|
|
|
url := n.Repository.HTMLURL() + "/commit/" + n.CommitID |
|
|
|
result.Subject = &api.NotificationSubject{ |
|
|
|
result.Subject = &api.NotificationSubject{ |
|
|
|
Type: api.NotifySubjectCommit, |
|
|
|
Type: api.NotifySubjectCommit, |
|
|
|
Title: n.CommitID, |
|
|
|
Title: n.CommitID, |
|
|
|
URL: n.Repository.HTMLURL() + "/commit/" + n.CommitID, |
|
|
|
URL: url, |
|
|
|
|
|
|
|
HTMLURL: url, |
|
|
|
} |
|
|
|
} |
|
|
|
case models.NotificationSourceRepository: |
|
|
|
case models.NotificationSourceRepository: |
|
|
|
result.Subject = &api.NotificationSubject{ |
|
|
|
result.Subject = &api.NotificationSubject{ |
|
|
|
Type: api.NotifySubjectRepository, |
|
|
|
Type: api.NotifySubjectRepository, |
|
|
|
Title: n.Repository.FullName(), |
|
|
|
Title: n.Repository.FullName(), |
|
|
|
|
|
|
|
// FIXME: this is a relative URL, rather useless and inconsistent, but keeping for backwards compat
|
|
|
|
URL: n.Repository.Link(), |
|
|
|
URL: n.Repository.Link(), |
|
|
|
|
|
|
|
HTMLURL: n.Repository.HTMLURL(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|