summaryrefslogtreecommitdiffstats
path: root/models/pull.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-10-22 14:47:24 -0400
committerUnknwon <u@gogs.io>2015-10-22 14:47:32 -0400
commit04af4b24fd87bb2ee8a2a3cecd66c5c1b1e413dd (patch)
tree5f40472782ead776d42b4975d3dab0f762911d70 /models/pull.go
parenta301c7ed26d401f9a01b52cac5c0d53f33a1121b (diff)
downloadgitea-04af4b24fd87bb2ee8a2a3cecd66c5c1b1e413dd.tar.gz
gitea-04af4b24fd87bb2ee8a2a3cecd66c5c1b1e413dd.zip
work on #1818
Diffstat (limited to 'models/pull.go')
-rw-r--r--models/pull.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/models/pull.go b/models/pull.go
index 8eb26ad775..142739b77f 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -250,13 +250,15 @@ func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch
}
// GetPullRequestByIssueID returns pull request by given issue ID.
-func GetPullRequestByIssueID(pullID int64) (*PullRequest, error) {
- pr := new(PullRequest)
- has, err := x.Where("pull_id=?", pullID).Get(pr)
+func GetPullRequestByIssueID(issueID int64) (*PullRequest, error) {
+ pr := &PullRequest{
+ IssueID: issueID,
+ }
+ has, err := x.Get(pr)
if err != nil {
return nil, err
} else if !has {
- return nil, ErrPullRequestNotExist{0, pullID, 0, 0, "", ""}
+ return nil, ErrPullRequestNotExist{0, issueID, 0, 0, "", ""}
}
return pr, nil
}