summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-09-09 05:09:23 +0800
committerGitHub <noreply@github.com>2023-09-08 21:09:23 +0000
commite3ed67859a434f2fef1db175e9c82251a7f9f6c9 (patch)
treee4c48b0c17d6d5a9507c3fc1479d7da2faba59dd /routers
parentb8ad558c93052ee3e2f43f1e24e6f5c134da36c4 (diff)
downloadgitea-e3ed67859a434f2fef1db175e9c82251a7f9f6c9.tar.gz
gitea-e3ed67859a434f2fef1db175e9c82251a7f9f6c9.zip
Move some functions to service layer (#26969)
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/collaborators.go4
-rw-r--r--routers/web/repo/setting/collaboration.go3
2 files changed, 3 insertions, 4 deletions
diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go
index 942d4c799f..66e7577a4b 100644
--- a/routers/api/v1/repo/collaborators.go
+++ b/routers/api/v1/repo/collaborators.go
@@ -8,7 +8,6 @@ import (
"errors"
"net/http"
- "code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/perm"
access_model "code.gitea.io/gitea/models/perm/access"
repo_model "code.gitea.io/gitea/models/repo"
@@ -19,6 +18,7 @@ import (
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/api/v1/utils"
"code.gitea.io/gitea/services/convert"
+ repo_service "code.gitea.io/gitea/services/repository"
)
// ListCollaborators list a repository's collaborators
@@ -228,7 +228,7 @@ func DeleteCollaborator(ctx *context.APIContext) {
return
}
- if err := models.DeleteCollaboration(ctx.Repo.Repository, collaborator.ID); err != nil {
+ if err := repo_service.DeleteCollaboration(ctx.Repo.Repository, collaborator.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteCollaboration", err)
return
}
diff --git a/routers/web/repo/setting/collaboration.go b/routers/web/repo/setting/collaboration.go
index 84e5fd30ca..212b0346bc 100644
--- a/routers/web/repo/setting/collaboration.go
+++ b/routers/web/repo/setting/collaboration.go
@@ -7,7 +7,6 @@ import (
"net/http"
"strings"
- "code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/models/perm"
@@ -128,7 +127,7 @@ func ChangeCollaborationAccessMode(ctx *context.Context) {
// DeleteCollaboration delete a collaboration for a repository
func DeleteCollaboration(ctx *context.Context) {
- if err := models.DeleteCollaboration(ctx.Repo.Repository, ctx.FormInt64("id")); err != nil {
+ if err := repo_service.DeleteCollaboration(ctx.Repo.Repository, ctx.FormInt64("id")); err != nil {
ctx.Flash.Error("DeleteCollaboration: " + err.Error())
} else {
ctx.Flash.Success(ctx.Tr("repo.settings.remove_collaborator_success"))