Move mail notification logic to service layer (#26905)

Extract from #22266
This commit is contained in:
Lunny Xiao 2023-09-05 17:26:59 +08:00 committed by GitHub
parent 0b10df67ce
commit a66d883a18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 21 deletions

View file

@ -21,6 +21,7 @@ import (
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/queue"
"code.gitea.io/gitea/modules/setting"
@ -392,6 +393,10 @@ func NewContext(ctx context.Context) {
return
}
if setting.Service.EnableNotifyMail {
notification.RegisterNotifier(NewNotifier())
}
switch setting.MailService.Protocol {
case "sendmail":
Sender = &sendmailSender{}