Skip to content

Commit 04af4b2

Browse files
committed
work on #1818
1 parent a301c7e commit 04af4b2

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

gogs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/gogits/gogs/modules/setting"
1818
)
1919

20-
const APP_VER = "0.6.16.1018 Beta"
20+
const APP_VER = "0.6.16.1022 Beta"
2121

2222
func init() {
2323
runtime.GOMAXPROCS(runtime.NumCPU())

models/error.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func (err ErrIssueNotExist) Error() string {
310310

311311
type ErrPullRequestNotExist struct {
312312
ID int64
313-
PullID int64
313+
IssueID int64
314314
HeadRepoID int64
315315
BaseRepoID int64
316316
HeadBarcnh string
@@ -323,8 +323,8 @@ func IsErrPullRequestNotExist(err error) bool {
323323
}
324324

325325
func (err ErrPullRequestNotExist) Error() string {
326-
return fmt.Sprintf("pull request does not exist [id: %d, pull_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
327-
err.ID, err.PullID, err.HeadRepoID, err.BaseRepoID, err.HeadBarcnh, err.BaseBranch)
326+
return fmt.Sprintf("pull request does not exist [id: %d, issue_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
327+
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBarcnh, err.BaseBranch)
328328
}
329329

330330
// _________ __

models/pull.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,15 @@ func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch
250250
}
251251

252252
// GetPullRequestByIssueID returns pull request by given issue ID.
253-
func GetPullRequestByIssueID(pullID int64) (*PullRequest, error) {
254-
pr := new(PullRequest)
255-
has, err := x.Where("pull_id=?", pullID).Get(pr)
253+
func GetPullRequestByIssueID(issueID int64) (*PullRequest, error) {
254+
pr := &PullRequest{
255+
IssueID: issueID,
256+
}
257+
has, err := x.Get(pr)
256258
if err != nil {
257259
return nil, err
258260
} else if !has {
259-
return nil, ErrPullRequestNotExist{0, pullID, 0, 0, "", ""}
261+
return nil, ErrPullRequestNotExist{0, issueID, 0, 0, "", ""}
260262
}
261263
return pr, nil
262264
}

templates/.VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.6.16.1018 Beta
1+
0.6.16.1022 Beta

0 commit comments

Comments
 (0)