From 104595d4df5e09d264f3343445e40aa5bd42da0b Mon Sep 17 00:00:00 2001 From: JakobDev Date: Tue, 19 Sep 2023 20:07:22 +0200 Subject: [PATCH 1/4] Don't run push mirrors for archived repos --- models/repo/pushmirror.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/models/repo/pushmirror.go b/models/repo/pushmirror.go index 73c1384444ddc..9d09e25fb382c 100644 --- a/models/repo/pushmirror.go +++ b/models/repo/pushmirror.go @@ -137,8 +137,11 @@ func GetPushMirrorsSyncedOnCommit(ctx context.Context, repoID int64) ([]*PushMir // PushMirrorsIterate iterates all push-mirror repositories. func PushMirrorsIterate(ctx context.Context, limit int, f func(idx int, bean any) error) error { sess := db.GetEngine(ctx). - Where("last_update + (`interval` / ?) <= ?", time.Second, time.Now().Unix()). - And("`interval` != 0"). + Table("push_mirror"). + Join("INNER", "`repository`", "`repository`.id = `push_mirror`.repo_id"). + Where("`push_mirror`.last_update + (`push_mirror`.`interval` / ?) <= ?", time.Second, time.Now().Unix()). + And("`push_mirror`.`interval` != 0"). + And("`repository`.is_archived = false"). OrderBy("last_update ASC") if limit > 0 { sess = sess.Limit(limit) From 5ae227ea169c6a873b631eb2f73cdc1e49ec1eb4 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Wed, 20 Sep 2023 09:46:19 +0200 Subject: [PATCH 2/4] Block Mirror Settings if Repo is archived --- options/locale/locale_en-US.ini | 1 + routers/api/v1/api.go | 8 +- routers/web/repo/setting/setting.go | 10 +- templates/repo/settings/options.tmpl | 346 ++++++++++++++------------- 4 files changed, 186 insertions(+), 179 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 74b8931de88ae..ca2ba59eb5c2d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2349,6 +2349,7 @@ settings.archive.error = An error occurred while trying to archive the repo. See settings.archive.error_ismirror = You cannot archive a mirrored repo. settings.archive.branchsettings_unavailable = Branch settings are not available if the repo is archived. settings.archive.tagsettings_unavailable = Tag settings are not available if the repo is archived. +settings.archive.mirrors_unavailable = Mirrors are not available if the repo is archived. settings.unarchive.button = Unarchive repo settings.unarchive.header = Unarchive this repo settings.unarchive.text = Unarchiving the repo will restore its ability to receive commits and pushes, as well as new issues and pull-requests. diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 763d56ecd2622..78f97b3dce933 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -1177,13 +1177,13 @@ func Routes() *web.Route { Delete(reqToken(), reqRepoWriter(unit.TypeReleases), repo.DeleteReleaseByTag) }) }, reqRepoReader(unit.TypeReleases)) - m.Post("/mirror-sync", reqToken(), reqRepoWriter(unit.TypeCode), repo.MirrorSync) - m.Post("/push_mirrors-sync", reqAdmin(), reqToken(), repo.PushMirrorSync) + m.Post("/mirror-sync", reqToken(), reqRepoWriter(unit.TypeCode), mustNotBeArchived, repo.MirrorSync) + m.Post("/push_mirrors-sync", reqAdmin(), reqToken(), mustNotBeArchived, repo.PushMirrorSync) m.Group("/push_mirrors", func() { m.Combo("").Get(repo.ListPushMirrors). - Post(bind(api.CreatePushMirrorOption{}), repo.AddPushMirror) + Post(mustNotBeArchived, bind(api.CreatePushMirrorOption{}), repo.AddPushMirror) m.Combo("/{name}"). - Delete(repo.DeletePushMirrorByRemoteName). + Delete(mustNotBeArchived, repo.DeletePushMirrorByRemoteName). Get(repo.GetPushMirrorByName) }, reqAdmin(), reqToken()) diff --git a/routers/web/repo/setting/setting.go b/routers/web/repo/setting/setting.go index 68943586ef588..33bc68b6d0dfa 100644 --- a/routers/web/repo/setting/setting.go +++ b/routers/web/repo/setting/setting.go @@ -185,7 +185,7 @@ func SettingsPost(ctx *context.Context) { ctx.Redirect(repo.Link() + "/settings") case "mirror": - if !setting.Mirror.Enabled || !repo.IsMirror { + if !setting.Mirror.Enabled || !repo.IsMirror || repo.IsArchived { ctx.NotFound("", nil) return } @@ -278,7 +278,7 @@ func SettingsPost(ctx *context.Context) { ctx.Redirect(repo.Link() + "/settings") case "mirror-sync": - if !setting.Mirror.Enabled || !repo.IsMirror { + if !setting.Mirror.Enabled || !repo.IsMirror || repo.IsArchived { ctx.NotFound("", nil) return } @@ -306,7 +306,7 @@ func SettingsPost(ctx *context.Context) { ctx.Redirect(repo.Link() + "/settings") case "push-mirror-update": - if !setting.Mirror.Enabled { + if !setting.Mirror.Enabled || repo.IsArchived { ctx.NotFound("", nil) return } @@ -343,7 +343,7 @@ func SettingsPost(ctx *context.Context) { ctx.Redirect(repo.Link() + "/settings") case "push-mirror-remove": - if !setting.Mirror.Enabled { + if !setting.Mirror.Enabled || repo.IsArchived { ctx.NotFound("", nil) return } @@ -372,7 +372,7 @@ func SettingsPost(ctx *context.Context) { ctx.Redirect(repo.Link() + "/settings") case "push-mirror-add": - if setting.Mirror.DisableNewPush { + if setting.Mirror.DisableNewPush || repo.IsArchived { ctx.NotFound("", nil) return } diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 28841de4cd69d..e9224b3ed7265 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -79,206 +79,212 @@ {{.locale.Tr "repo.settings.mirror_settings"}}
- {{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.doc_link_pull_section"}}
- {{else if $onlyNewPushMirrorsEnabled}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} - {{$.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.more_information_if_disabled"}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

- {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} - {{if $existingPushMirror}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}} - {{end}} + {{if .Repository.IsArchived}} +
+ {{.locale.Tr "repo.settings.archive.mirrors_unavailable"}} +
{{else}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}
- {{end}} - - {{if $existingPushMirror}} - - - - - - - - + {{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.doc_link_pull_section"}}
+ {{else if $onlyNewPushMirrorsEnabled}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} + {{$.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.more_information_if_disabled"}} + {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

+ {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} + {{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_use"}}
{{end}} - {{if $modifyBrokenPullMirror}} - {{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}} +
{{$.locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}{{$.locale.Tr "repo.settings.mirror_settings.direction"}}{{$.locale.Tr "repo.settings.mirror_settings.last_update"}}
+ {{if $existingPushMirror}} + + + + + + + + + {{end}} + {{if $modifyBrokenPullMirror}} + {{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}} + + + + + + {{else if $isWorkingPullMirror}} - + + + - - {{else if $isWorkingPullMirror}} - - - - - - - - - - - - - {{end}}{{/* end if: IsMirror */}} - - {{range .PushMirrors}} - - - - - - - {{else}} - - - - {{end}} - {{if (not .DisableNewPushMirrors)}} - {{end}} - -
{{$.locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}{{$.locale.Tr "repo.settings.mirror_settings.direction"}}{{$.locale.Tr "repo.settings.mirror_settings.last_update"}}
+
{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{$.locale.Tr "error.occurred"}}
+
-
{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{$.locale.Tr "error.occurred"}}
+
{{.PullMirror.RemoteAddress}}{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}{{DateTime "full" .PullMirror.UpdatedUnix}} +
+ {{.CsrfTokenHtml}} + + +
{{.PullMirror.RemoteAddress}}{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}{{DateTime "full" .PullMirror.UpdatedUnix}} -
- {{.CsrfTokenHtml}} - - -
-
-
- {{template "base/disable_form_autofill"}} - {{.CsrfTokenHtml}} - -
- -
- - -
-
-
- - -
- {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false}} -
- - -

{{.locale.Tr "repo.mirror_address_desc"}}

-
-
- - {{.locale.Tr "repo.need_auth"}} - -
-
- - -
-
- - -
-

{{.locale.Tr "repo.mirror_password_help"}}

-
-
- - {{if .LFSStartServer}} -
- -
- - -
-
-
- - -

{{.locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}

-
- {{end}} -
- -
-
-
{{.RemoteAddress}}{{$.locale.Tr "repo.settings.mirror_settings.direction.push"}}{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{$.locale.Tr "never"}}{{end}} {{if .LastError}}
{{$.locale.Tr "error"}}
{{end}}
- -
- {{$.CsrfTokenHtml}} - - - -
-
- {{$.CsrfTokenHtml}} - - - -
-
{{$.locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}
{{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - -
- - + +
+ +
+ + +
+
+
+ + +
+ {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false}} +
+ +

{{.locale.Tr "repo.mirror_address_desc"}}

-
+
{{.locale.Tr "repo.need_auth"}}
-
- - +
+ +
-
- - +
+ +
+

{{.locale.Tr "repo.mirror_password_help"}}

-
+ + {{if .LFSStartServer}} +
+
- - + +
-
- - +
+ + +

{{.locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}

+ {{end}}
- +
+ + + {{end}}{{/* end if: IsMirror */}} + + {{range .PushMirrors}} + + {{.RemoteAddress}} + {{$.locale.Tr "repo.settings.mirror_settings.direction.push"}} + {{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{$.locale.Tr "never"}}{{end}} {{if .LastError}}
{{$.locale.Tr "error"}}
{{end}} + + +
+ {{$.CsrfTokenHtml}} + + + +
+
+ {{$.CsrfTokenHtml}} + + + +
+ + + {{else}} + + {{$.locale.Tr "repo.settings.mirror_settings.push_mirror.none"}} + + {{end}} + {{if (not .DisableNewPushMirrors)}} + + +
+ {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + +
+ + +

{{.locale.Tr "repo.mirror_address_desc"}}

+
+
+ + {{.locale.Tr "repo.need_auth"}} + +
+
+ + +
+
+ + +
+
+
+
+
+ + +
+
+
+ + +
+
+ +
+
+ + + {{end}} + + + {{end}}
{{end}} From 9941698bc10687b4d9e095cb107d740c54323bb5 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Tue, 23 Jan 2024 10:06:42 +0100 Subject: [PATCH 3/4] Update --- models/repo/pushmirror.go | 2 +- templates/repo/settings/options.tmpl | 454 +++++++++++++-------------- 2 files changed, 228 insertions(+), 228 deletions(-) diff --git a/models/repo/pushmirror.go b/models/repo/pushmirror.go index 9d09e25fb382c..a5c7bfeb7b8a9 100644 --- a/models/repo/pushmirror.go +++ b/models/repo/pushmirror.go @@ -141,7 +141,7 @@ func PushMirrorsIterate(ctx context.Context, limit int, f func(idx int, bean any Join("INNER", "`repository`", "`repository`.id = `push_mirror`.repo_id"). Where("`push_mirror`.last_update + (`push_mirror`.`interval` / ?) <= ?", time.Second, time.Now().Unix()). And("`push_mirror`.`interval` != 0"). - And("`repository`.is_archived = false"). + And("`repository`.is_archived = ?", false). OrderBy("last_update ASC") if limit > 0 { sess = sess.Limit(limit) diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index e9224b3ed7265..f750b738e6aa1 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -1,7 +1,7 @@ {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}}

- {{.locale.Tr "repo.settings.basic_settings"}} + {{ctx.Locale.Tr "repo.settings.basic_settings"}}

@@ -9,43 +9,43 @@ {{.CsrfTokenHtml}}
- +
- + {{FileSize .Repository.Size}}
- +
- +
{{if not .Repository.IsFork}}
- -
+ +
{{if .IsAdmin}} {{else}} {{end}} - +
{{end}}
- +
- +
- +
@@ -53,12 +53,12 @@
{{.CsrfTokenHtml}}
- +
- - + +
@@ -66,7 +66,7 @@ {{/* 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)}} {{/* .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}} + {{$showMirrorSettings := and (.Repository.UnitEnabled $.Context $.UnitTypeCode) (or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors)}} {{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} {{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} {{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} @@ -76,7 +76,7 @@ {{if $showMirrorSettings}}

- {{.locale.Tr "repo.settings.mirror_settings"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings"}}

{{if .Repository.IsArchived}} @@ -85,33 +85,33 @@
{{else}} {{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.doc_link_pull_section"}}
+ {{ctx.Locale.Tr "repo.settings.mirror_settings.docs"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

+ {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_pull_section"}}
{{else if $onlyNewPushMirrorsEnabled}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}
+ {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} + {{ctx.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.more_information_if_disabled"}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

- {{$.locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}

+ {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} {{if $existingPushMirror}} - {{$.locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}} + {{ctx.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_use"}}
+ {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}
{{end}} {{if $existingPushMirror}} - - - + + + @@ -121,7 +121,7 @@ @@ -129,13 +129,13 @@ - + @@ -146,55 +146,55 @@ {{.CsrfTokenHtml}}
- +
- +
- +
{{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false}}
- + -

{{.locale.Tr "repo.mirror_address_desc"}}

+

{{ctx.Locale.Tr "repo.mirror_address_desc"}}

- {{.locale.Tr "repo.need_auth"}} + {{ctx.Locale.Tr "repo.need_auth"}}
- +
- - + +
-

{{.locale.Tr "repo.mirror_password_help"}}

+

{{ctx.Locale.Tr "repo.mirror_password_help"}}

{{if .LFSStartServer}}
- +
- +
- - -

{{.locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}

+ + +

{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}

{{end}}
- +
@@ -206,13 +206,13 @@ {{range .PushMirrors}} - - + + {{else}} - + {{end}} {{if (not .DisableNewPushMirrors)}} @@ -246,21 +246,21 @@ {{.CsrfTokenHtml}}
- + -

{{.locale.Tr "repo.mirror_address_desc"}}

+

{{ctx.Locale.Tr "repo.mirror_address_desc"}}

- {{.locale.Tr "repo.need_auth"}} + {{ctx.Locale.Tr "repo.need_auth"}}
- +
- +
@@ -268,15 +268,15 @@
- +
- +
- +
@@ -289,7 +289,7 @@ {{end}}

- {{.locale.Tr "repo.settings.advanced_settings"}} + {{ctx.Locale.Tr "repo.settings.advanced_settings"}}

@@ -299,10 +299,10 @@ {{$isCodeEnabled := .Repository.UnitEnabled $.Context $.UnitTypeCode}} {{$isCodeGlobalDisabled := .UnitTypeCode.UnitGlobalDisabled}}
- -
+ +
- +
@@ -311,29 +311,29 @@ {{$isExternalWikiGlobalDisabled := .UnitTypeExternalWiki.UnitGlobalDisabled}} {{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}}
- -
+ +
- +
-
+
- +
-
+
- +
- + -

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

+

{{ctx.Locale.Tr "repo.settings.external_wiki_url_desc"}}

@@ -344,17 +344,17 @@ {{$isExternalTrackerGlobalDisabled := .UnitTypeExternalTracker.UnitGlobalDisabled}} {{$isIssuesAndExternalGlobalDisabled := and $isIssuesGlobalDisabled $isExternalTrackerGlobalDisabled}}
- -
+ +
- +
-
+
- +
@@ -362,71 +362,71 @@
- +
- +
{{end}}
- +
- +
-
+
- +
- + -

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

+

{{ctx.Locale.Tr "repo.settings.external_tracker_url_desc"}}

- + -

{{.locale.Tr "repo.settings.tracker_url_format_desc" | Str2html}}

+

{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc" | Str2html}}

- +
{{$externalTracker := (.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker)}} {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}} - +
- +
- +
- + -

{{.locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | Str2html}}

+

{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | Str2html}}

@@ -436,30 +436,30 @@ {{$isProjectsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeProjects}} {{$isProjectsGlobalDisabled := .UnitTypeProjects.UnitGlobalDisabled}}
- -
+ +
- +
{{$isReleasesEnabled := .Repository.UnitEnabled $.Context $.UnitTypeReleases}} {{$isReleasesGlobalDisabled := .UnitTypeReleases.UnitGlobalDisabled}}
- -
+ +
- +
{{$isPackagesEnabled := .Repository.UnitEnabled $.Context $.UnitTypePackages}} {{$isPackagesGlobalDisabled := .UnitTypePackages.UnitGlobalDisabled}}
- -
+ +
- +
@@ -467,10 +467,10 @@ {{$isActionsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeActions}} {{$isActionsGlobalDisabled := .UnitTypeActions.UnitGlobalDisabled}}
- -
+ +
- +
{{end}} @@ -481,110 +481,110 @@ {{$pullRequestGlobalDisabled := .UnitTypePullRequests.UnitGlobalDisabled}} {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}}
- -
+ +
- +

- {{.locale.Tr "repo.settings.merge_style_desc"}} + {{ctx.Locale.Tr "repo.settings.merge_style_desc"}}

- +
- +
- +
- +
- +

- {{.locale.Tr "repo.settings.default_merge_style_desc"}} + {{ctx.Locale.Tr "repo.settings.default_merge_style_desc"}}

- +
- +
- +
- +
- +
@@ -592,60 +592,60 @@
- +

- {{.locale.Tr "repo.settings.signing_settings"}} + {{ctx.Locale.Tr "repo.settings.signing_settings"}}

{{.CsrfTokenHtml}}
-
+
- -

{{.locale.Tr "repo.settings.trust_model.default.desc"}}

+ +

{{ctx.Locale.Tr "repo.settings.trust_model.default.desc"}}

- -

{{.locale.Tr "repo.settings.trust_model.collaborator.desc"}}

+ +

{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.desc"}}

- -

{{.locale.Tr "repo.settings.trust_model.committer.desc"}}

+ +

{{ctx.Locale.Tr "repo.settings.trust_model.committer.desc"}}

- -

{{.locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc"}}

+ +

{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc"}}

- +
{{if .IsAdmin}}

- {{.locale.Tr "repo.settings.admin_settings"}} + {{ctx.Locale.Tr "repo.settings.admin_settings"}}

@@ -654,12 +654,12 @@
- +
- +
@@ -668,27 +668,27 @@ {{.CsrfTokenHtml}} {{if .CodeIndexerEnabled}} -

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

+

{{ctx.Locale.Tr "repo.settings.admin_code_indexer"}}

- + {{if .CodeIndexerStatus}} {{ShortSha .CodeIndexerStatus.CommitSha}} {{else}} - {{.locale.Tr "repo.settings.admin_indexer_unindexed"}} + {{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}} {{end}}
- +
{{end}} -

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

+

{{ctx.Locale.Tr "repo.settings.admin_stats_indexer"}}

{{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}} - + {{end}} {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}} @@ -696,11 +696,11 @@ {{ShortSha .StatsIndexerStatus.CommitSha}} {{else}} - {{.locale.Tr "repo.settings.admin_indexer_unindexed"}} + {{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}} {{end}}
- +
@@ -709,40 +709,40 @@ {{if .Permission.IsOwner}}

- {{.locale.Tr "repo.settings.danger_zone"}} + {{ctx.Locale.Tr "repo.settings.danger_zone"}}

{{if .Repository.IsMirror}}
-
{{.locale.Tr "repo.settings.convert"}}
-
{{.locale.Tr "repo.settings.convert_desc"}}
+
{{ctx.Locale.Tr "repo.settings.convert"}}
+
{{ctx.Locale.Tr "repo.settings.convert_desc"}}
- +
{{end}} {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
-
{{.locale.Tr "repo.settings.convert_fork"}}
-
{{.locale.Tr "repo.settings.convert_fork_desc"}}
+
{{ctx.Locale.Tr "repo.settings.convert_fork"}}
+
{{ctx.Locale.Tr "repo.settings.convert_fork_desc"}}
- +
{{end}}
-
{{.locale.Tr "repo.settings.transfer"}}
+
{{ctx.Locale.Tr "repo.settings.transfer"}}
{{if .RepoTransfer}} - {{.locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName}} + {{ctx.Locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName}} {{else}} - {{.locale.Tr "repo.settings.transfer_desc"}} + {{ctx.Locale.Tr "repo.settings.transfer_desc"}} {{end}}
@@ -751,50 +751,50 @@
{{.CsrfTokenHtml}} - + {{else}} - + {{end}}
{{if .Permission.CanRead $.UnitTypeWiki}}
-
{{.locale.Tr "repo.settings.wiki_delete"}}
-
{{.locale.Tr "repo.settings.wiki_delete_desc"}}
+
{{ctx.Locale.Tr "repo.settings.wiki_delete"}}
+
{{ctx.Locale.Tr "repo.settings.wiki_delete_desc"}}
- +
{{end}}
-
{{.locale.Tr "repo.settings.delete"}}
-
{{.locale.Tr "repo.settings.delete_desc"}}
+
{{ctx.Locale.Tr "repo.settings.delete"}}
+
{{ctx.Locale.Tr "repo.settings.delete_desc"}}
- +
{{if not .Repository.IsMirror}}
{{if .Repository.IsArchived}} -
{{.locale.Tr "repo.settings.unarchive.header"}}
-
{{.locale.Tr "repo.settings.unarchive.text"}}
+
{{ctx.Locale.Tr "repo.settings.unarchive.header"}}
+
{{ctx.Locale.Tr "repo.settings.unarchive.text"}}
{{else}} -
{{.locale.Tr "repo.settings.archive.header"}}
-
{{.locale.Tr "repo.settings.archive.text"}}
+
{{ctx.Locale.Tr "repo.settings.archive.header"}}
+
{{ctx.Locale.Tr "repo.settings.archive.text"}}
{{end}}
@@ -810,29 +810,29 @@ {{if .Repository.IsMirror}}
{{$.locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}{{$.locale.Tr "repo.settings.mirror_settings.direction"}}{{$.locale.Tr "repo.settings.mirror_settings.last_update"}}{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}
-
{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{$.locale.Tr "error.occurred"}}
+
{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}
{{.PullMirror.RemoteAddress}}{{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}}{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}} {{DateTime "full" .PullMirror.UpdatedUnix}}
{{.CsrfTokenHtml}} - +
{{.RemoteAddress}}{{$.locale.Tr "repo.settings.mirror_settings.direction.push"}}{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{$.locale.Tr "never"}}{{end}} {{if .LastError}}
{{$.locale.Tr "error"}}
{{end}}
{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}
{{ctx.Locale.Tr "error"}}
{{end}}
+
{{$.CsrfTokenHtml}} - +
{{$.locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}