summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-09-06 02:37:47 +0800
committerGitHub <noreply@github.com>2023-09-05 18:37:47 +0000
commit540bf9fa6d0d86297c9d575640798b718767bd9f (patch)
tree4b4a782b71e6f066af6c7807337745dc5ee6899a /routers/api/v1/repo
parent084eacb5d42f1ed2520442a4bbc91bb70c9759e1 (diff)
downloadgitea-540bf9fa6d0d86297c9d575640798b718767bd9f.tar.gz
gitea-540bf9fa6d0d86297c9d575640798b718767bd9f.zip
Move notification interface to services layer (#26915)
Extract from #22266
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/issue.go6
-rw-r--r--routers/api/v1/repo/migrate.go4
-rw-r--r--routers/api/v1/repo/pull.go8
-rw-r--r--routers/api/v1/repo/wiki.go8
4 files changed, 13 insertions, 13 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index a08fdf5940..2fad55df3d 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -20,7 +20,6 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/context"
issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
- "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
@@ -29,6 +28,7 @@ import (
"code.gitea.io/gitea/routers/api/v1/utils"
"code.gitea.io/gitea/services/convert"
issue_service "code.gitea.io/gitea/services/issue"
+ notify_service "code.gitea.io/gitea/services/notify"
)
// SearchIssues searches for issues across the repositories that the user has access to
@@ -859,11 +859,11 @@ func EditIssue(ctx *context.APIContext) {
}
if titleChanged {
- notification.NotifyIssueChangeTitle(ctx, ctx.Doer, issue, oldTitle)
+ notify_service.IssueChangeTitle(ctx, ctx.Doer, issue, oldTitle)
}
if statusChangeComment != nil {
- notification.NotifyIssueChangeStatus(ctx, ctx.Doer, "", issue, statusChangeComment, issue.IsClosed)
+ notify_service.IssueChangeStatus(ctx, ctx.Doer, "", issue, statusChangeComment, issue.IsClosed)
}
// Refetch from database to assign some automatic values
diff --git a/routers/api/v1/repo/migrate.go b/routers/api/v1/repo/migrate.go
index 84327de5fb..dfc9004620 100644
--- a/routers/api/v1/repo/migrate.go
+++ b/routers/api/v1/repo/migrate.go
@@ -22,7 +22,6 @@ import (
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/log"
base "code.gitea.io/gitea/modules/migration"
- "code.gitea.io/gitea/modules/notification"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
@@ -31,6 +30,7 @@ import (
"code.gitea.io/gitea/services/convert"
"code.gitea.io/gitea/services/forms"
"code.gitea.io/gitea/services/migrations"
+ notify_service "code.gitea.io/gitea/services/notify"
)
// Migrate migrate remote git repository to gitea
@@ -195,7 +195,7 @@ func Migrate(ctx *context.APIContext) {
}
if err == nil {
- notification.NotifyMigrateRepository(ctx, ctx.Doer, repoOwner, repo)
+ notify_service.MigrateRepository(ctx, ctx.Doer, repoOwner, repo)
return
}
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 58f2fc69ce..f0b958c4cd 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -24,7 +24,6 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
- "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
@@ -36,6 +35,7 @@ import (
"code.gitea.io/gitea/services/forms"
"code.gitea.io/gitea/services/gitdiff"
issue_service "code.gitea.io/gitea/services/issue"
+ notify_service "code.gitea.io/gitea/services/notify"
pull_service "code.gitea.io/gitea/services/pull"
repo_service "code.gitea.io/gitea/services/repository"
)
@@ -594,11 +594,11 @@ func EditPullRequest(ctx *context.APIContext) {
}
if titleChanged {
- notification.NotifyIssueChangeTitle(ctx, ctx.Doer, issue, oldTitle)
+ notify_service.IssueChangeTitle(ctx, ctx.Doer, issue, oldTitle)
}
if statusChangeComment != nil {
- notification.NotifyIssueChangeStatus(ctx, ctx.Doer, "", issue, statusChangeComment, issue.IsClosed)
+ notify_service.IssueChangeStatus(ctx, ctx.Doer, "", issue, statusChangeComment, issue.IsClosed)
}
// change pull target branch
@@ -622,7 +622,7 @@ func EditPullRequest(ctx *context.APIContext) {
}
return
}
- notification.NotifyPullRequestChangeTargetBranch(ctx, ctx.Doer, pr, form.Base)
+ notify_service.PullRequestChangeTargetBranch(ctx, ctx.Doer, pr, form.Base)
}
// update allow edits
diff --git a/routers/api/v1/repo/wiki.go b/routers/api/v1/repo/wiki.go
index 7f3a7d0674..1fd1b91936 100644
--- a/routers/api/v1/repo/wiki.go
+++ b/routers/api/v1/repo/wiki.go
@@ -12,12 +12,12 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
- "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/services/convert"
+ notify_service "code.gitea.io/gitea/services/notify"
wiki_service "code.gitea.io/gitea/services/wiki"
)
@@ -85,7 +85,7 @@ func NewWikiPage(ctx *context.APIContext) {
wikiPage := getWikiPage(ctx, wikiName)
if !ctx.Written() {
- notification.NotifyNewWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, string(wikiName), form.Message)
+ notify_service.NewWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, string(wikiName), form.Message)
ctx.JSON(http.StatusCreated, wikiPage)
}
}
@@ -153,7 +153,7 @@ func EditWikiPage(ctx *context.APIContext) {
wikiPage := getWikiPage(ctx, newWikiName)
if !ctx.Written() {
- notification.NotifyEditWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, string(newWikiName), form.Message)
+ notify_service.EditWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, string(newWikiName), form.Message)
ctx.JSON(http.StatusOK, wikiPage)
}
}
@@ -242,7 +242,7 @@ func DeleteWikiPage(ctx *context.APIContext) {
return
}
- notification.NotifyDeleteWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, string(wikiName))
+ notify_service.DeleteWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, string(wikiName))
ctx.Status(http.StatusNoContent)
}