summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-02 11:13:37 -0400
committerUnknwon <u@gogs.io>2015-09-02 11:13:37 -0400
commit5da306c0e5a2939b836d5ec00a0984a2c30e0f9f (patch)
tree6b4632617336a3536fddbe31ad50aab9f389580e
parentd951824ff9c52919e2821d0e9be2504550a994fc (diff)
downloadgitea-5da306c0e5a2939b836d5ec00a0984a2c30e0f9f.tar.gz
gitea-5da306c0e5a2939b836d5ec00a0984a2c30e0f9f.zip
tmp: fix issue open count
-rw-r--r--models/issue.go7
-rw-r--r--routers/repo/pull.go3
2 files changed, 5 insertions, 5 deletions
diff --git a/models/issue.go b/models/issue.go
index 9810a2595a..fff33cf369 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -903,16 +903,15 @@ func (pr *PullRequest) AfterSet(colName string, _ xorm.Cell) {
}
// Merge merges pull request to base repository.
-func (pr *PullRequest) Merge(baseGitRepo *git.Repository) (err error) {
+func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error) {
sess := x.NewSession()
defer sessionRelease(sess)
if err = sess.Begin(); err != nil {
return err
}
- pr.Pull.IsClosed = true
- if _, err = sess.Id(pr.Pull.ID).AllCols().Update(pr.Pull); err != nil {
- return fmt.Errorf("update pull: %v", err)
+ if err = pr.Pull.changeStatus(sess, doer, true); err != nil {
+ return fmt.Errorf("Pull.changeStatus: %v", err)
}
headRepoPath := RepoPath(pr.HeadUserName, pr.HeadRepo.Name)
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index b55d928b61..caa651c621 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -381,7 +381,8 @@ func MergePullRequest(ctx *middleware.Context) {
}
pr.Pull = pull
- if err = pr.Merge(ctx.Repo.GitRepo); err != nil {
+ pr.Pull.Repo = ctx.Repo.Repository
+ if err = pr.Merge(ctx.User, ctx.Repo.GitRepo); err != nil {
ctx.Handle(500, "GetPullRequestByPullID", err)
return
}