summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2020-06-02 20:21:38 -0500
committerGitHub <noreply@github.com>2020-06-02 21:21:38 -0400
commita6fd2f23f7e6bdc60c092207ac43af3a9a291f8f (patch)
treee9abecb2896bcb688235d8aba3a76281cde64873 /routers
parentd0a18a12704360c06cf48b586956148a17a4505a (diff)
downloadgitea-a6fd2f23f7e6bdc60c092207ac43af3a9a291f8f.tar.gz
gitea-a6fd2f23f7e6bdc60c092207ac43af3a9a291f8f.zip
Allow site admin to disable mirrors (#11740)
* Allow site admin to disable mirrors Signed-off-by: jolheiser <john.olheiser@gmail.com> * No need to run through Safe Signed-off-by: jolheiser <john.olheiser@gmail.com> * Clarify only disabling NEW mirrors Signed-off-by: jolheiser <john.olheiser@gmail.com> * Apply suggestions from @guillep2k Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/migrate.go2
-rw-r--r--routers/repo/repo.go3
2 files changed, 3 insertions, 2 deletions
diff --git a/routers/api/v1/repo/migrate.go b/routers/api/v1/repo/migrate.go
index fd0db7814c..aefbffa8fa 100644
--- a/routers/api/v1/repo/migrate.go
+++ b/routers/api/v1/repo/migrate.go
@@ -118,7 +118,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
RepoName: form.RepoName,
Description: form.Description,
Private: form.Private || setting.Repository.ForcePrivate,
- Mirror: form.Mirror,
+ Mirror: form.Mirror && !setting.Repository.DisableMirrors,
AuthUsername: form.AuthUsername,
AuthPassword: form.AuthPassword,
Wiki: form.Wiki,
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index b0bb608d09..4ded75db6c 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -259,6 +259,7 @@ func Migrate(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("new_migrate")
ctx.Data["private"] = getRepoPrivate(ctx)
ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
+ ctx.Data["DisableMirrors"] = setting.Repository.DisableMirrors
ctx.Data["mirror"] = ctx.Query("mirror") == "1"
ctx.Data["wiki"] = ctx.Query("wiki") == "1"
ctx.Data["milestones"] = ctx.Query("milestones") == "1"
@@ -360,7 +361,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
RepoName: form.RepoName,
Description: form.Description,
Private: form.Private || setting.Repository.ForcePrivate,
- Mirror: form.Mirror,
+ Mirror: form.Mirror && !setting.Repository.DisableMirrors,
AuthUsername: form.AuthUsername,
AuthPassword: form.AuthPassword,
Wiki: form.Wiki,