From 0b10bd8569007a91835e8ee9b91a8c4aa2a1803c Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Sat, 29 Apr 2023 23:42:34 +0200 Subject: [PATCH 01/12] Hide 'Mirror Settings' when unneeded, improve hints --- options/locale/locale_en-US.ini | 6 +++++- templates/repo/settings/options.tmpl | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 32d9bebc8b1a3..84b3badbeb6d2 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1888,7 +1888,11 @@ settings.hooks = Webhooks settings.githooks = Git Hooks settings.basic_settings = Basic Settings settings.mirror_settings = Mirror Settings -settings.mirror_settings.docs = Set up your project to automatically push and/or pull changes to/from another repository. Branches, tags, and commits will be synced automatically. How do I mirror repositories? +settings.mirror_settings.docs = Set up your project to automatically push and/or pull changes to/from another repository. Branches, tags, and commits will be synced automatically. How do I mirror repositories? +settings.mirror_settings.docs.no_new_pull_mirrors = Set up your project to automatically push changes to another repository. Branches, tags, and commits will be synced automatically. How do I mirror repositories? +settings.mirror_settings.docs.no_new_push_mirrors = Push mirrors are currently disabled on your instance. +settings.mirror_settings.docs.no_new_mirrors = Your repository is mirroring changes to/from another repository. Please keep in mind that you can't create any new mirrors at this time, however, you may still modify your settings here. How do I mirror repositories? +settings.mirror_settings.docs.pull_mirror_instructions = To set up a pull mirror, please consult "Pulling from a remote repository" section. settings.mirror_settings.mirrored_repository = Mirrored repository settings.mirror_settings.direction = Direction settings.mirror_settings.direction.pull = Pull diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 515854609a1eb..6bd458ed15a9a 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -67,12 +67,20 @@ - {{if .MirrorsEnabled}} + {{if and .MirrorsEnabled (or (or .PullMirrors .PushMirrors) .Repository.IsMirror)}}

{{.locale.Tr "repo.settings.mirror_settings"}}

- {{$.locale.Tr "repo.settings.mirror_settings.docs" | Safe}} + {{if and .PushMirrors .PullMirrors}} + {{$.locale.Tr "repo.settings.mirror_settings.docs" | Safe}} {{$.locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions" | Safe}} + {{else if and .PushMirrors (not .PullMirrors)}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_pull_mirrors" | Safe}} + {{else if and (not .PushMirrors) .PullMirrors}} + {{$.locale.Tr "repo.settings.mirror_settings.docs_no_new_push_mirrors" | Safe}} {{$.locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions" | Safe}} + {{else}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors" | Safe}} + {{end}} {{if or .Repository.IsMirror .PushMirrors}} From a176a4c402bfbe8f27d628746df960f0617cb318 Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Sun, 30 Apr 2023 00:36:31 +0200 Subject: [PATCH 02/12] Fix logic error --- templates/repo/settings/options.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 6bd458ed15a9a..a413c8da921e1 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -67,7 +67,7 @@ - {{if and .MirrorsEnabled (or (or .PullMirrors .PushMirrors) .Repository.IsMirror)}} + {{if or (or .PullMirrors .PushMirrors) .Repository.IsMirror}}

{{.locale.Tr "repo.settings.mirror_settings"}}

From 60ad6edad3c18e8092e454f8c1ce251f580680d1 Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Sun, 30 Apr 2023 00:49:18 +0200 Subject: [PATCH 03/12] Fix error --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 84b3badbeb6d2..fbb12e240443a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1892,7 +1892,7 @@ settings.mirror_settings.docs = Set up your project to automatically push and/or settings.mirror_settings.docs.no_new_pull_mirrors = Set up your project to automatically push changes to another repository. Branches, tags, and commits will be synced automatically. How do I mirror repositories? settings.mirror_settings.docs.no_new_push_mirrors = Push mirrors are currently disabled on your instance. settings.mirror_settings.docs.no_new_mirrors = Your repository is mirroring changes to/from another repository. Please keep in mind that you can't create any new mirrors at this time, however, you may still modify your settings here. How do I mirror repositories? -settings.mirror_settings.docs.pull_mirror_instructions = To set up a pull mirror, please consult "Pulling from a remote repository" section. +settings.mirror_settings.docs.pull_mirror_instructions = To set up a pull mirror, please consult the "Pulling from a remote repository" section. settings.mirror_settings.mirrored_repository = Mirrored repository settings.mirror_settings.direction = Direction settings.mirror_settings.direction.pull = Pull From 8b8bca4237ce742517ea8a2cc3a4de641ff763aa Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Sun, 30 Apr 2023 01:58:35 +0200 Subject: [PATCH 04/12] Fix everything (somewhat) --- options/locale/locale_en-US.ini | 15 ++++++++++----- routers/web/repo/setting.go | 2 ++ templates/repo/settings/options.tmpl | 26 ++++++++++++++++++-------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index fbb12e240443a..e8ce93ae40863 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1888,11 +1888,16 @@ settings.hooks = Webhooks settings.githooks = Git Hooks settings.basic_settings = Basic Settings settings.mirror_settings = Mirror Settings -settings.mirror_settings.docs = Set up your project to automatically push and/or pull changes to/from another repository. Branches, tags, and commits will be synced automatically. How do I mirror repositories? -settings.mirror_settings.docs.no_new_pull_mirrors = Set up your project to automatically push changes to another repository. Branches, tags, and commits will be synced automatically. How do I mirror repositories? -settings.mirror_settings.docs.no_new_push_mirrors = Push mirrors are currently disabled on your instance. -settings.mirror_settings.docs.no_new_mirrors = Your repository is mirroring changes to/from another repository. Please keep in mind that you can't create any new mirrors at this time, however, you may still modify your settings here. How do I mirror repositories? -settings.mirror_settings.docs.pull_mirror_instructions = To set up a pull mirror, please consult the "Pulling from a remote repository" section. +settings.mirror_settings.docs = Set up your project to automatically push and/or pull changes to/from another repository. Branches, tags, and commits will be synced automatically. +settings.mirror_settings.docs.disabled_pull_mirror.instructions = Set up your project to automatically push changes to another repository. Branches, tags, and commits will be synced automatically. Pull mirrors have been disabled by your site administrator. +settings.mirror_settings.docs.disabled_push_mirror.instructions = Set up your project to automatically pull changes from another repository. Branches, tags, and commits will be synced automatically. +settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning = Right now, this can only be done in the "New Migration" menu. For more information, please consult: +settings.mirror_settings.docs.disabled_push_mirror.info = Push mirrors have been disabled by your site administrator. +settings.mirror_settings.docs.no_new_mirrors = Your repository is mirroring changes to/from another repository. Please keep in mind that you can't create any new mirrors at this time. +settings.mirror_settings.docs.can_still_modify = However, you may still modify your settings here. +settings.mirror_settings.docs.pull_mirror_instructions = To set up a pull mirror, please consult: +settings.mirror_settings.docs.doc_link_title = How do I mirror repositories? +settings.mirror_settings.docs.pulling_remote_title = Pulling from a remote repository settings.mirror_settings.mirrored_repository = Mirrored repository settings.mirror_settings.direction = Direction settings.mirror_settings.direction.pull = Pull diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go index 0c36503b3c4fc..72adfa3e59260 100644 --- a/routers/web/repo/setting.go +++ b/routers/web/repo/setting.go @@ -64,6 +64,7 @@ func SettingsCtxData(ctx *context.Context) { ctx.Data["PageIsSettingsOptions"] = true ctx.Data["ForcePrivate"] = setting.Repository.ForcePrivate ctx.Data["MirrorsEnabled"] = setting.Mirror.Enabled + ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull ctx.Data["DisableNewPushMirrors"] = setting.Mirror.DisableNewPush ctx.Data["DefaultMirrorInterval"] = setting.Mirror.DefaultInterval ctx.Data["MinimumMirrorInterval"] = setting.Mirror.MinInterval @@ -108,6 +109,7 @@ func SettingsPost(ctx *context.Context) { ctx.Data["ForcePrivate"] = setting.Repository.ForcePrivate ctx.Data["MirrorsEnabled"] = setting.Mirror.Enabled + ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull ctx.Data["DisableNewPushMirrors"] = setting.Mirror.DisableNewPush ctx.Data["DefaultMirrorInterval"] = setting.Mirror.DefaultInterval ctx.Data["MinimumMirrorInterval"] = setting.Mirror.MinInterval diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index a413c8da921e1..7b1d6ec7474de 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -67,19 +67,29 @@ - {{if or (or .PullMirrors .PushMirrors) .Repository.IsMirror}} + {{if or (not (and .DisableNewPullMirrors .DisableNewPushMirrors)) .Repository.IsMirror}}

{{.locale.Tr "repo.settings.mirror_settings"}}

- {{if and .PushMirrors .PullMirrors}} - {{$.locale.Tr "repo.settings.mirror_settings.docs" | Safe}} {{$.locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions" | Safe}} - {{else if and .PushMirrors (not .PullMirrors)}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_pull_mirrors" | Safe}} - {{else if and (not .PushMirrors) .PullMirrors}} - {{$.locale.Tr "repo.settings.mirror_settings.docs_no_new_push_mirrors" | Safe}} {{$.locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions" | Safe}} + {{if and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} + {{$.locale.Tr "repo.settings.mirror_settings.docs"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

+ {{$.locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.pulling_remote_title"}}

+ {{else if and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} + {{$.locale.Tr "settings.mirror_settings.docs.doc_link_title"}} + {{else if and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

+ {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} + {{if .PushMirrors}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_modify"}} + {{end}} {{else}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors" | Safe}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_modify"}} {{end}}
{{if or .Repository.IsMirror .PushMirrors}} From 83e2316a778bb619396a2f42f2259ee0f1f21b7d Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Tue, 9 May 2023 07:53:38 +0000 Subject: [PATCH 05/12] Update options/locale/locale_en-US.ini Co-authored-by: silverwind --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e8ce93ae40863..b433af3bf11ed 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1890,7 +1890,7 @@ settings.basic_settings = Basic Settings settings.mirror_settings = Mirror Settings settings.mirror_settings.docs = Set up your project to automatically push and/or pull changes to/from another repository. Branches, tags, and commits will be synced automatically. settings.mirror_settings.docs.disabled_pull_mirror.instructions = Set up your project to automatically push changes to another repository. Branches, tags, and commits will be synced automatically. Pull mirrors have been disabled by your site administrator. -settings.mirror_settings.docs.disabled_push_mirror.instructions = Set up your project to automatically pull changes from another repository. Branches, tags, and commits will be synced automatically. +settings.mirror_settings.docs.disabled_push_mirror.instructions = Set up your project to automatically pull commits, tags and branches from another repository. settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning = Right now, this can only be done in the "New Migration" menu. For more information, please consult: settings.mirror_settings.docs.disabled_push_mirror.info = Push mirrors have been disabled by your site administrator. settings.mirror_settings.docs.no_new_mirrors = Your repository is mirroring changes to/from another repository. Please keep in mind that you can't create any new mirrors at this time. From 63e5ab46abb06beb897a50509cd7a00cc3d6d48e Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Tue, 9 May 2023 07:53:45 +0000 Subject: [PATCH 06/12] Update options/locale/locale_en-US.ini Co-authored-by: silverwind --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b433af3bf11ed..939ecb82c9d70 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1888,7 +1888,7 @@ settings.hooks = Webhooks settings.githooks = Git Hooks settings.basic_settings = Basic Settings settings.mirror_settings = Mirror Settings -settings.mirror_settings.docs = Set up your project to automatically push and/or pull changes to/from another repository. Branches, tags, and commits will be synced automatically. +settings.mirror_settings.docs = Set up your repository to automatically synchronize commits, tags and branches with another repository. settings.mirror_settings.docs.disabled_pull_mirror.instructions = Set up your project to automatically push changes to another repository. Branches, tags, and commits will be synced automatically. Pull mirrors have been disabled by your site administrator. settings.mirror_settings.docs.disabled_push_mirror.instructions = Set up your project to automatically pull commits, tags and branches from another repository. settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning = Right now, this can only be done in the "New Migration" menu. For more information, please consult: From 19f9c9978b5f85e06bfad9bb8382f9e3f16c8c14 Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Tue, 9 May 2023 07:53:55 +0000 Subject: [PATCH 07/12] Update options/locale/locale_en-US.ini Co-authored-by: silverwind --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 939ecb82c9d70..80402f26db27d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1889,7 +1889,7 @@ settings.githooks = Git Hooks settings.basic_settings = Basic Settings settings.mirror_settings = Mirror Settings settings.mirror_settings.docs = Set up your repository to automatically synchronize commits, tags and branches with another repository. -settings.mirror_settings.docs.disabled_pull_mirror.instructions = Set up your project to automatically push changes to another repository. Branches, tags, and commits will be synced automatically. Pull mirrors have been disabled by your site administrator. +settings.mirror_settings.docs.disabled_pull_mirror.instructions = Set up your project to automatically push commits, tags and branches to another repository. Pull mirrors have been disabled by your site administrator. settings.mirror_settings.docs.disabled_push_mirror.instructions = Set up your project to automatically pull commits, tags and branches from another repository. settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning = Right now, this can only be done in the "New Migration" menu. For more information, please consult: settings.mirror_settings.docs.disabled_push_mirror.info = Push mirrors have been disabled by your site administrator. From ab071a428f00427a75d24b67b44a16442ad1b254 Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Fri, 12 May 2023 08:27:52 +0000 Subject: [PATCH 08/12] Update options/locale/locale_en-US.ini Co-authored-by: silverwind --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 80402f26db27d..03421d0541e52 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1893,7 +1893,7 @@ settings.mirror_settings.docs.disabled_pull_mirror.instructions = Set up your pr settings.mirror_settings.docs.disabled_push_mirror.instructions = Set up your project to automatically pull commits, tags and branches from another repository. settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning = Right now, this can only be done in the "New Migration" menu. For more information, please consult: settings.mirror_settings.docs.disabled_push_mirror.info = Push mirrors have been disabled by your site administrator. -settings.mirror_settings.docs.no_new_mirrors = Your repository is mirroring changes to/from another repository. Please keep in mind that you can't create any new mirrors at this time. +settings.mirror_settings.docs.no_new_mirrors = Your repository is mirroring changes to or from another repository. Please keep in mind that you can't create any new mirrors at this time. settings.mirror_settings.docs.can_still_modify = However, you may still modify your settings here. settings.mirror_settings.docs.pull_mirror_instructions = To set up a pull mirror, please consult: settings.mirror_settings.docs.doc_link_title = How do I mirror repositories? From ded822e6b5fe42278e3fbffa836b4a17c2661f4e Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Fri, 12 May 2023 10:28:47 +0200 Subject: [PATCH 09/12] Remove bold letters --- templates/repo/settings/options.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 7b1d6ec7474de..9079c26aa3778 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -82,7 +82,7 @@ {{$.locale.Tr "settings.mirror_settings.docs.doc_link_title"}} {{else if and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

{{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} {{if .PushMirrors}} From 7e6a03352d14eda5c95e0c8fd958de052a18506d Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Sun, 28 May 2023 12:38:24 +0200 Subject: [PATCH 10/12] Use variables to simplify logic - Fix small visual error - Fix small logic error (wow, those variables really helped) --- templates/repo/settings/options.tmpl | 29 +++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 50600019a5f14..0e077ec534d7e 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -67,32 +67,43 @@ - {{if or (not (and .DisableNewPullMirrors .DisableNewPushMirrors)) .Repository.IsMirror}} + + {{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}} + {{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} + {{$showMirrorSettings := or $newMirrorsPartiallyEnabled .Repository.IsMirror}} + {{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} + {{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} + {{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} + {{$modifyExistingPushMirror := or .Repository.IsMirror .PushMirrors}} + {{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}} + {{$isWorkingPullMirror := .PullMirror}} + + {{if $showMirrorSettings}}

{{.locale.Tr "repo.settings.mirror_settings"}}

- {{if and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} + {{if $newMirrorsEntirelyEnabled}} {{$.locale.Tr "repo.settings.mirror_settings.docs"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

{{$.locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.pulling_remote_title"}}

- {{else if and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.pulling_remote_title"}}
+ {{else if $onlyNewPushMirrorsEnabled}} {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} {{$.locale.Tr "settings.mirror_settings.docs.doc_link_title"}} - {{else if and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} + {{else if $onlyNewPullMirrorsEnabled}} {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

{{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} - {{if .PushMirrors}} + {{if $modifyExistingPushMirror}} {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_modify"}} {{end}} {{else}} {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_modify"}} {{end}}
- {{if or .Repository.IsMirror .PushMirrors}} + {{if $modifyExistingPushMirror}} @@ -102,7 +113,7 @@ {{end}} - {{if and .Repository.IsMirror (not .PullMirror)}} + {{if $modifyBrokenPullMirror}} {{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}} @@ -111,7 +122,7 @@ - {{else if .PullMirror}} + {{else if $isWorkingPullMirror}} From bcb5c7b771b17c6e57c210acd5db5bfa7336abaa Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Sun, 28 May 2023 14:18:40 +0200 Subject: [PATCH 11/12] Change wording to represent behavior, line breaks, fix string errors, show menu even when errors exist --- templates/repo/settings/options.tmpl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 0e077ec534d7e..a5e23b221bdfb 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -70,11 +70,12 @@ {{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}} {{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} - {{$showMirrorSettings := or $newMirrorsPartiallyEnabled .Repository.IsMirror}} + {{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}} + {{$showMirrorSettings := or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors}} {{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} {{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} {{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} - {{$modifyExistingPushMirror := or .Repository.IsMirror .PushMirrors}} + {{$existingPushMirror := or .Repository.IsMirror .PushMirrors}} {{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}} {{$isWorkingPullMirror := .PullMirror}} @@ -87,23 +88,23 @@ {{$.locale.Tr "repo.settings.mirror_settings.docs"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

{{$.locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.pulling_remote_title"}}
+ {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}
{{else if $onlyNewPushMirrorsEnabled}} {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} - {{$.locale.Tr "settings.mirror_settings.docs.doc_link_title"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}
{{else if $onlyNewPullMirrorsEnabled}} {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

{{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} - {{if $modifyExistingPushMirror}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_modify"}} + {{if $existingPushMirror}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}} {{end}} {{else}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_modify"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}
{{end}}
{{$.locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}
{{(MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false).Address}}
- {{if $modifyExistingPushMirror}} + {{if $existingPushMirror}} From 6faf184e290040b7e5679ad0290e81af1fd6005b Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Mon, 29 May 2023 10:08:12 +0200 Subject: [PATCH 12/12] Improve wording in user-facing string --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index a41d54f19bd39..b15e51e7b584b 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1913,7 +1913,7 @@ settings.mirror_settings.docs.disabled_push_mirror.instructions = Set up your pr settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning = Right now, this can only be done in the "New Migration" menu. For more information, please consult: settings.mirror_settings.docs.disabled_push_mirror.info = Push mirrors have been disabled by your site administrator. settings.mirror_settings.docs.no_new_mirrors = Your repository is mirroring changes to or from another repository. Please keep in mind that you can't create any new mirrors at this time. -settings.mirror_settings.docs.can_still_modify = However, you may still modify your settings here. +settings.mirror_settings.docs.can_still_use = Although you can't modify existing mirrors or create new ones, you may still use your existing mirror. settings.mirror_settings.docs.pull_mirror_instructions = To set up a pull mirror, please consult: settings.mirror_settings.docs.doc_link_title = How do I mirror repositories? settings.mirror_settings.docs.pulling_remote_title = Pulling from a remote repository
{{$.locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}