summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2017-01-28 14:01:07 -0200
committerAndrey Nering <andrey.nering@gmail.com>2017-01-28 14:01:07 -0200
commit5348e8b71ab42ae04c59b70b5225035bfe05b0a0 (patch)
tree216494ab0efe19e43e0509e4c9085ad193167c05 /models
parent27d30f1a619ff716e39d79e7322c487e1299b75d (diff)
downloadgitea-5348e8b71ab42ae04c59b70b5225035bfe05b0a0.tar.gz
gitea-5348e8b71ab42ae04c59b70b5225035bfe05b0a0.zip
Fix color: closed PR was showing as purple instead of red
Diffstat (limited to 'models')
-rw-r--r--models/issue.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/models/issue.go b/models/issue.go
index cb5f8bb068..6d557ad4ef 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -93,6 +93,16 @@ func (issue *Issue) loadRepo(e Engine) (err error) {
return nil
}
+// GetPullRequest returns the issue pull request
+func (issue *Issue) GetPullRequest() (pr *PullRequest, err error) {
+ if !issue.IsPull {
+ return nil, fmt.Errorf("Issue is not a pull request")
+ }
+
+ pr, err = getPullRequestByIssueID(x, issue.ID)
+ return
+}
+
func (issue *Issue) loadAttributes(e Engine) (err error) {
if err := issue.loadRepo(e); err != nil {
return err
@@ -953,9 +963,9 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
switch opts.IsPull {
case util.OptionalBoolTrue:
- sess.And("issue.is_pull=?",true)
+ sess.And("issue.is_pull=?", true)
case util.OptionalBoolFalse:
- sess.And("issue.is_pull=?",false)
+ sess.And("issue.is_pull=?", false)
}
sortIssuesSession(sess, opts.SortType)
@@ -1780,4 +1790,3 @@ func DeleteMilestoneByRepoID(repoID, id int64) error {
}
return sess.Commit()
}
-