summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2017-01-28 17:54:37 -0200
committerGitHub <noreply@github.com>2017-01-28 17:54:37 -0200
commitcc31a21192cba31cc2ede74b44f1c4e19621d4f7 (patch)
treef0c582aea5988ab6d27fd70de5e76f4d8421871c /models
parent31c717f57957902081e64e9db3211216bf61f45b (diff)
parentaa591317e7085185f754b6a6b998c87ef6467f6e (diff)
downloadgitea-cc31a21192cba31cc2ede74b44f1c4e19621d4f7.tar.gz
gitea-cc31a21192cba31cc2ede74b44f1c4e19621d4f7.zip
Merge pull request #781 from andreynering/notifications-step-5
Notifications step 5
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()
}
-