mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 00:54:04 +01:00
fix setMerged for remove unnecessary db connection (#1067)
This commit is contained in:
parent
522f194983
commit
d4e38cf129
1 changed files with 11 additions and 6 deletions
|
@ -115,11 +115,15 @@ func (pr *PullRequest) LoadAttributes() error {
|
|||
|
||||
// LoadIssue loads issue information from database
|
||||
func (pr *PullRequest) LoadIssue() (err error) {
|
||||
return pr.loadIssue(x)
|
||||
}
|
||||
|
||||
func (pr *PullRequest) loadIssue(e Engine) (err error) {
|
||||
if pr.Issue != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
pr.Issue, err = GetIssueByID(pr.IssueID)
|
||||
pr.Issue, err = getIssueByID(e, pr.IssueID)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -405,14 +409,15 @@ func (pr *PullRequest) setMerged() (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
if err = pr.LoadIssue(); err != nil {
|
||||
if err = pr.loadIssue(sess); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pr.Issue.Repo.Owner == nil {
|
||||
if err = pr.Issue.Repo.GetOwner(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = pr.Issue.loadRepo(sess); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = pr.Issue.Repo.getOwner(sess); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = pr.Issue.changeStatus(sess, pr.Merger, pr.Issue.Repo, true); err != nil {
|
||||
|
|
Loading…
Reference in a new issue