aboutsummaryrefslogtreecommitdiff
path: root/models/pull.go
diff options
context:
space:
mode:
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 8eb26ad7..142739b7 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
}