summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2016-12-02 12:10:39 +0100
committerGitHub <noreply@github.com>2016-12-02 12:10:39 +0100
commit0f05470cb84a4dcfd00e69e5af51b4420b74e9d4 (patch)
tree9b6296dc8cfc660090fe90220397a015725e219f /models/issue.go
parentd7ed78a91971260169c429f9ee47ebe8fa8f92ad (diff)
downloadgitea-0f05470cb84a4dcfd00e69e5af51b4420b74e9d4.tar.gz
gitea-0f05470cb84a4dcfd00e69e5af51b4420b74e9d4.zip
[API] Pull Requests (#248)
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/models/issue.go b/models/issue.go
index 990d4a4bc5..7ef3d00e41 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -170,6 +170,22 @@ func (issue *Issue) HTMLURL() string {
return fmt.Sprintf("%s/%s/%d", issue.Repo.HTMLURL(), path, issue.Index)
}
+// DiffURL returns the absolute URL to this diff
+func (issue *Issue) DiffURL() string {
+ if issue.IsPull {
+ return fmt.Sprintf("%s/pulls/%d.diff", issue.Repo.HTMLURL(), issue.Index)
+ }
+ return ""
+}
+
+// PatchURL returns the absolute URL to this patch
+func (issue *Issue) PatchURL() string {
+ if issue.IsPull {
+ return fmt.Sprintf("%s/pulls/%d.patch", issue.Repo.HTMLURL(), issue.Index)
+ }
+ return ""
+}
+
// State returns string representation of issue status.
func (issue *Issue) State() api.StateType {
if issue.IsClosed {