diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-11-06 19:28:11 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-07 11:28:11 +0800 |
commit | 276500c314db1c0ef360088753861ffc010a99da (patch) | |
tree | 2e03a4daa7f38bfaa607b4fefe6e161d88bd724a /routers/web/repo/setting | |
parent | 913be9e8ac1b745c9eb6dda06146e090166c8b79 (diff) | |
download | gitea-276500c314db1c0ef360088753861ffc010a99da.tar.gz gitea-276500c314db1c0ef360088753861ffc010a99da.zip |
Move AddCollabrator and CreateRepositoryByExample to service layer (#32419)
- [x] Move `CreateRepositoryByExample` to service layer
- [x] Move `AddCollabrator` to service layer
- [x] Add a new parameter for `AddCollabrator` so that changing mode
immediately after that will become unnecessary.
Diffstat (limited to 'routers/web/repo/setting')
-rw-r--r-- | routers/web/repo/setting/collaboration.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/routers/web/repo/setting/collaboration.go b/routers/web/repo/setting/collaboration.go index 31f9f76d0f..18ecff8250 100644 --- a/routers/web/repo/setting/collaboration.go +++ b/routers/web/repo/setting/collaboration.go @@ -14,7 +14,6 @@ import ( unit_model "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/log" - repo_module "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/services/context" "code.gitea.io/gitea/services/mailer" @@ -100,12 +99,12 @@ func CollaborationPost(ctx *context.Context) { } } - if err = repo_module.AddCollaborator(ctx, ctx.Repo.Repository, u); err != nil { + if err = repo_service.AddOrUpdateCollaborator(ctx, ctx.Repo.Repository, u, perm.AccessModeWrite); err != nil { if errors.Is(err, user_model.ErrBlockedUser) { ctx.Flash.Error(ctx.Tr("repo.settings.add_collaborator.blocked_user")) ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") } else { - ctx.ServerError("AddCollaborator", err) + ctx.ServerError("AddOrUpdateCollaborator", err) } return } |