Move notification interface to services layer (#26915)

Extract from #22266
This commit is contained in:
Lunny Xiao 2023-09-06 02:37:47 +08:00 committed by GitHub
parent 084eacb5d4
commit 540bf9fa6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 972 additions and 969 deletions

View file

@ -19,10 +19,10 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
notify_service "code.gitea.io/gitea/services/notify"
pull_service "code.gitea.io/gitea/services/pull"
)
@ -47,7 +47,7 @@ func CreateRepository(ctx context.Context, doer, owner *user_model.User, opts re
return nil, err
}
notification.NotifyCreateRepository(ctx, doer, owner, repo)
notify_service.CreateRepository(ctx, doer, owner, repo)
return repo, nil
}
@ -60,7 +60,7 @@ func DeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_mod
if notify {
// If the repo itself has webhooks, we need to trigger them before deleting it...
notification.NotifyDeleteRepository(ctx, doer, repo)
notify_service.DeleteRepository(ctx, doer, repo)
}
if err := models.DeleteRepository(doer, repo.OwnerID, repo.ID); err != nil {