diff options
Diffstat (limited to 'models/issues')
-rw-r--r-- | models/issues/comment.go | 2 | ||||
-rw-r--r-- | models/issues/issue.go | 12 |
2 files changed, 3 insertions, 11 deletions
diff --git a/models/issues/comment.go b/models/issues/comment.go index bdc574252c..6877991a93 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -886,7 +886,7 @@ func updateCommentInfos(ctx context.Context, opts *CreateCommentOptions, comment } } case CommentTypeReopen, CommentTypeClose: - if err = updateIssueClosedNum(ctx, opts.Issue); err != nil { + if err = repo_model.UpdateRepoIssueNumbers(ctx, opts.Issue.RepoID, opts.Issue.IsPull, true); err != nil { return err } } diff --git a/models/issues/issue.go b/models/issues/issue.go index b1b140732b..ca48f425f2 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -725,7 +725,8 @@ func doChangeIssueStatus(ctx context.Context, issue *Issue, doer *user_model.Use } } - if err := updateIssueClosedNum(ctx, issue); err != nil { + // update repository's issue closed number + if err := repo_model.UpdateRepoIssueNumbers(ctx, issue.RepoID, issue.IsPull, true); err != nil { return nil, err } @@ -2137,15 +2138,6 @@ func (issue *Issue) BlockingDependencies(ctx context.Context) (issueDeps []*Depe return issueDeps, err } -func updateIssueClosedNum(ctx context.Context, issue *Issue) (err error) { - if issue.IsPull { - err = repo_model.StatsCorrectNumClosed(ctx, issue.RepoID, true, "num_closed_pulls") - } else { - err = repo_model.StatsCorrectNumClosed(ctx, issue.RepoID, false, "num_closed_issues") - } - return err -} - // FindAndUpdateIssueMentions finds users mentioned in the given content string, and saves them in the database. func FindAndUpdateIssueMentions(ctx context.Context, issue *Issue, doer *user_model.User, content string) (mentions []*user_model.User, err error) { rawMentions := references.FindAllMentionsMarkdown(content) |