diff options
-rw-r--r-- | modules/notification/notification.go | 6 | ||||
-rw-r--r-- | routers/init.go | 4 | ||||
-rw-r--r-- | services/feed/action.go (renamed from modules/notification/action/action.go) | 9 | ||||
-rw-r--r-- | services/feed/action_test.go (renamed from modules/notification/action/action_test.go) | 4 | ||||
-rw-r--r-- | services/repository/transfer_test.go | 4 |
5 files changed, 14 insertions, 13 deletions
diff --git a/modules/notification/notification.go b/modules/notification/notification.go index c265388a18..3c29dd9256 100644 --- a/modules/notification/notification.go +++ b/modules/notification/notification.go @@ -12,7 +12,6 @@ import ( user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/notification/action" "code.gitea.io/gitea/modules/notification/base" "code.gitea.io/gitea/modules/repository" ) @@ -25,11 +24,6 @@ func RegisterNotifier(notifier base.Notifier) { notifiers = append(notifiers, notifier) } -// NewContext registers notification handlers -func NewContext() { - RegisterNotifier(action.NewNotifier()) -} - // NotifyNewWikiPage notifies creating new wiki pages to notifiers func NotifyNewWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page, comment string) { for _, notifier := range notifiers { diff --git a/routers/init.go b/routers/init.go index f311b4f95d..6369a39754 100644 --- a/routers/init.go +++ b/routers/init.go @@ -18,7 +18,6 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/external" - "code.gitea.io/gitea/modules/notification" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/ssh" "code.gitea.io/gitea/modules/storage" @@ -38,6 +37,7 @@ import ( "code.gitea.io/gitea/services/auth/source/oauth2" "code.gitea.io/gitea/services/automerge" "code.gitea.io/gitea/services/cron" + feed_service "code.gitea.io/gitea/services/feed" indexer_service "code.gitea.io/gitea/services/indexer" "code.gitea.io/gitea/services/mailer" mailer_incoming "code.gitea.io/gitea/services/mailer/incoming" @@ -119,7 +119,7 @@ func InitWebInstalled(ctx context.Context) { mailer.NewContext(ctx) mustInit(cache.NewContext) - notification.NewContext() + mustInit(feed_service.Init) mustInit(uinotification.Init) mustInit(archiver.Init) diff --git a/modules/notification/action/action.go b/services/feed/action.go index 1d759e4923..3516e79fea 100644 --- a/modules/notification/action/action.go +++ b/services/feed/action.go @@ -1,7 +1,7 @@ // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package action +package feed import ( "context" @@ -16,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/notification" "code.gitea.io/gitea/modules/notification/base" "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/util" @@ -27,6 +28,12 @@ type actionNotifier struct { var _ base.Notifier = &actionNotifier{} +func Init() error { + notification.RegisterNotifier(NewNotifier()) + + return nil +} + // NewNotifier create a new actionNotifier notifier func NewNotifier() base.Notifier { return &actionNotifier{} diff --git a/modules/notification/action/action_test.go b/services/feed/action_test.go index 05ce70f388..1037ba768e 100644 --- a/modules/notification/action/action_test.go +++ b/services/feed/action_test.go @@ -1,7 +1,7 @@ // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package action +package feed import ( "path/filepath" @@ -19,7 +19,7 @@ import ( func TestMain(m *testing.M) { unittest.MainTest(m, &unittest.TestOptions{ - GiteaRootPath: filepath.Join("..", "..", ".."), + GiteaRootPath: filepath.Join("..", ".."), }) } diff --git a/services/repository/transfer_test.go b/services/repository/transfer_test.go index 1299e66be2..53ba3c2441 100644 --- a/services/repository/transfer_test.go +++ b/services/repository/transfer_test.go @@ -15,8 +15,8 @@ import ( "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/notification" - "code.gitea.io/gitea/modules/notification/action" "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/services/feed" "github.com/stretchr/testify/assert" ) @@ -25,7 +25,7 @@ var notifySync sync.Once func registerNotifier() { notifySync.Do(func() { - notification.RegisterNotifier(action.NewNotifier()) + notification.RegisterNotifier(feed.NewNotifier()) }) } |