aboutsummaryrefslogtreecommitdiffstats
path: root/services/cron
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-18 13:58:42 +0800
committerGitHub <noreply@github.com>2021-11-18 13:58:42 +0800
commit3c3855a05c79ccc7a8495cdbf4a361e7bef74248 (patch)
tree43f8616bca25a09c0e284e9407819ba43a6a0d79 /services/cron
parent6874fe90e591fa1bfb4b0575b27d876ab544e6e0 (diff)
downloadgitea-3c3855a05c79ccc7a8495cdbf4a361e7bef74248.tar.gz
gitea-3c3855a05c79ccc7a8495cdbf4a361e7bef74248.zip
Move user functions into user.go (#17659)
* Move user functions into user.go * Fix test
Diffstat (limited to 'services/cron')
-rw-r--r--services/cron/tasks.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/cron/tasks.go b/services/cron/tasks.go
index 56c363e0b8..d29bf6d6bd 100644
--- a/services/cron/tasks.go
+++ b/services/cron/tasks.go
@@ -11,6 +11,7 @@ import (
"sync"
"code.gitea.io/gitea/models"
+ admin_model "code.gitea.io/gitea/models/admin"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
@@ -89,18 +90,18 @@ func (t *Task) RunWithUser(doer *models.User, config Config) {
if err := t.fun(ctx, doer, config); err != nil {
if db.IsErrCancelled(err) {
message := err.(db.ErrCancelled).Message
- if err := models.CreateNotice(models.NoticeTask, config.FormatMessage(t.Name, "aborted", doer, message)); err != nil {
+ if err := admin_model.CreateNotice(admin_model.NoticeTask, config.FormatMessage(t.Name, "aborted", doer, message)); err != nil {
log.Error("CreateNotice: %v", err)
}
return
}
- if err := models.CreateNotice(models.NoticeTask, config.FormatMessage(t.Name, "error", doer, err)); err != nil {
+ if err := admin_model.CreateNotice(admin_model.NoticeTask, config.FormatMessage(t.Name, "error", doer, err)); err != nil {
log.Error("CreateNotice: %v", err)
}
return
}
if config.DoNoticeOnSuccess() {
- if err := models.CreateNotice(models.NoticeTask, config.FormatMessage(t.Name, "finished", doer)); err != nil {
+ if err := admin_model.CreateNotice(admin_model.NoticeTask, config.FormatMessage(t.Name, "finished", doer)); err != nil {
log.Error("CreateNotice: %v", err)
}
}