Skip to content

Commit 6c73c0d

Browse files
authored
Move ui notification to service layer (#26907)
Extract from #22266
1 parent dc2dd76 commit 6c73c0d

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

modules/notification/notification.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"code.gitea.io/gitea/modules/log"
1515
"code.gitea.io/gitea/modules/notification/action"
1616
"code.gitea.io/gitea/modules/notification/base"
17-
"code.gitea.io/gitea/modules/notification/ui"
1817
"code.gitea.io/gitea/modules/repository"
1918
)
2019

@@ -28,7 +27,6 @@ func RegisterNotifier(notifier base.Notifier) {
2827

2928
// NewContext registers notification handlers
3029
func NewContext() {
31-
RegisterNotifier(ui.NewNotifier())
3230
RegisterNotifier(action.NewNotifier())
3331
}
3432

routers/init.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import (
4848
repo_service "code.gitea.io/gitea/services/repository"
4949
"code.gitea.io/gitea/services/repository/archiver"
5050
"code.gitea.io/gitea/services/task"
51+
"code.gitea.io/gitea/services/uinotification"
5152
"code.gitea.io/gitea/services/webhook"
5253
)
5354

@@ -119,6 +120,7 @@ func InitWebInstalled(ctx context.Context) {
119120
mailer.NewContext(ctx)
120121
mustInit(cache.NewContext)
121122
notification.NewContext()
123+
mustInit(uinotification.Init)
122124
mustInit(archiver.Init)
123125

124126
highlight.NewContext()

modules/notification/ui/ui.go renamed to services/uinotification/notify.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2018 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33

4-
package ui
4+
package uinotification
55

66
import (
77
"context"
@@ -14,6 +14,7 @@ import (
1414
"code.gitea.io/gitea/modules/container"
1515
"code.gitea.io/gitea/modules/graceful"
1616
"code.gitea.io/gitea/modules/log"
17+
"code.gitea.io/gitea/modules/notification"
1718
"code.gitea.io/gitea/modules/notification/base"
1819
"code.gitea.io/gitea/modules/queue"
1920
)
@@ -32,6 +33,12 @@ type (
3233
}
3334
)
3435

36+
func Init() error {
37+
notification.RegisterNotifier(NewNotifier())
38+
39+
return nil
40+
}
41+
3542
var _ base.Notifier = &notificationService{}
3643

3744
// NewNotifier create a new notificationService notifier

0 commit comments

Comments
 (0)