aboutsummaryrefslogtreecommitdiffstats
path: root/modules/repofiles/action.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-12-16 05:57:34 +0800
committertechknowlogick <techknowlogick@gitea.io>2019-12-15 16:57:34 -0500
commit67b316a954b161cac27e16b6455837881919dd94 (patch)
tree46e0278f556447cd9228d63c49a32dacea1f3352 /modules/repofiles/action.go
parentc6b3c5bcefde6be4c64f5769a38962c2ce6ad6de (diff)
downloadgitea-67b316a954b161cac27e16b6455837881919dd94.tar.gz
gitea-67b316a954b161cac27e16b6455837881919dd94.zip
Refactor comment (#9330)
* Refactor comment * fix test * improve code
Diffstat (limited to 'modules/repofiles/action.go')
-rw-r--r--modules/repofiles/action.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/repofiles/action.go b/modules/repofiles/action.go
index 517c145659..a5a5e151cb 100644
--- a/modules/repofiles/action.go
+++ b/modules/repofiles/action.go
@@ -31,7 +31,7 @@ func getIssueFromRef(repo *models.Repository, index int64) (*models.Issue, error
return issue, nil
}
-func changeIssueStatus(repo *models.Repository, issue *models.Issue, doer *models.User, status bool) error {
+func changeIssueStatus(repo *models.Repository, issue *models.Issue, doer *models.User, closed bool) error {
stopTimerIfAvailable := func(doer *models.User, issue *models.Issue) error {
if models.StopwatchExists(doer.ID, issue.ID) {
@@ -44,7 +44,8 @@ func changeIssueStatus(repo *models.Repository, issue *models.Issue, doer *model
}
issue.Repo = repo
- if err := issue.ChangeStatus(doer, status); err != nil {
+ comment, err := issue.ChangeStatus(doer, closed)
+ if err != nil {
// Don't return an error when dependencies are open as this would let the push fail
if models.IsErrDependenciesLeft(err) {
return stopTimerIfAvailable(doer, issue)
@@ -52,6 +53,8 @@ func changeIssueStatus(repo *models.Repository, issue *models.Issue, doer *model
return err
}
+ notification.NotifyIssueChangeStatus(doer, issue, comment, closed)
+
return stopTimerIfAvailable(doer, issue)
}