From 129638117f1eed78475a041bd65097e56939caca Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 25 Feb 2016 14:17:55 -0500 Subject: #2697 fix panic when close issue via commit message --- models/action.go | 4 ++-- models/issue.go | 8 ++++---- models/pull.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'models') diff --git a/models/action.go b/models/action.go index c1e23339f1..678d6c6094 100644 --- a/models/action.go +++ b/models/action.go @@ -368,7 +368,7 @@ func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string continue } - if err = issue.ChangeStatus(u, true); err != nil { + if err = issue.ChangeStatus(u, repo, true); err != nil { return err } } @@ -408,7 +408,7 @@ func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string continue } - if err = issue.ChangeStatus(u, false); err != nil { + if err = issue.ChangeStatus(u, repo, false); err != nil { return err } } diff --git a/models/issue.go b/models/issue.go index 7d7fb49a61..62db35d48a 100644 --- a/models/issue.go +++ b/models/issue.go @@ -218,7 +218,7 @@ func (i *Issue) ReadBy(uid int64) error { return UpdateIssueUserByRead(uid, i.ID) } -func (i *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (err error) { +func (i *Issue) changeStatus(e *xorm.Session, doer *User, repo *Repository, isClosed bool) (err error) { if i.IsClosed == isClosed { return nil } @@ -251,7 +251,7 @@ func (i *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (err er } // New action comment. - if _, err = createStatusComment(e, doer, i.Repo, i); err != nil { + if _, err = createStatusComment(e, doer, repo, i); err != nil { return err } @@ -259,14 +259,14 @@ func (i *Issue) changeStatus(e *xorm.Session, doer *User, isClosed bool) (err er } // ChangeStatus changes issue status to open/closed. -func (i *Issue) ChangeStatus(doer *User, isClosed bool) (err error) { +func (i *Issue) ChangeStatus(doer *User, repo *Repository, isClosed bool) (err error) { sess := x.NewSession() defer sessionRelease(sess) if err = sess.Begin(); err != nil { return err } - if err = i.changeStatus(sess, doer, isClosed); err != nil { + if err = i.changeStatus(sess, doer, repo, isClosed); err != nil { return err } diff --git a/models/pull.go b/models/pull.go index 47da2dd67e..276dc1bcfd 100644 --- a/models/pull.go +++ b/models/pull.go @@ -138,7 +138,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error return err } - if err = pr.Issue.changeStatus(sess, doer, true); err != nil { + if err = pr.Issue.changeStatus(sess, doer, pr.Issue.Repo, true); err != nil { return fmt.Errorf("Issue.changeStatus: %v", err) } -- cgit v1.2.3