Skip to content

Disable all mirror feature elements when DISABLE_MIRRORS is enabled #13084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ DISABLED_REPO_UNITS =
DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects
; Prefix archive files by placing them in a directory named after the repository
PREFIX_ARCHIVE_FILES = true
; Disable the creation of new mirrors. Pre-existing mirrors remain valid.
; Disable mirroring feature. Pre-existing mirrors remain valid but cannot be updated (may be converted to regular repo).
DISABLE_MIRRORS = false
; The default branch name of new repositories
DEFAULT_BRANCH=master
Expand Down
2 changes: 1 addition & 1 deletion docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `ENABLE_PUSH_CREATE_USER`: **false**: Allow users to push local repositories to Gitea and have them automatically created for a user.
- `ENABLE_PUSH_CREATE_ORG`: **false**: Allow users to push local repositories to Gitea and have them automatically created for an org.
- `PREFIX_ARCHIVE_FILES`: **true**: Prefix archive files by placing them in a directory named after the repository.
- `DISABLE_MIRRORS`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid.
- `DISABLE_MIRRORS`: **false**: Disable mirroring feature. Pre-existing mirrors remain valid but cannot be updated (may be converted to regular repo).
- `DEFAULT_BRANCH`: **master**: Default branch name of all repositories.

### Repository - Pull Request (`repository.pull-request`)
Expand Down
5 changes: 4 additions & 1 deletion modules/cron/tasks_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/migrations"
repository_service "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
mirror_service "code.gitea.io/gitea/services/mirror"
)

Expand Down Expand Up @@ -109,7 +110,9 @@ func registerUpdateMigrationPosterID() {
}

func initBasicTasks() {
registerUpdateMirrorTask()
if !setting.Repository.DisableMirrors {
registerUpdateMirrorTask()
}
registerRepoHealthCheck()
registerCheckRepoStats()
registerArchiveCleanup()
Expand Down
1 change: 1 addition & 0 deletions routers/user/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func Dashboard(ctx *context.Context) {

ctx.Data["Title"] = ctxUser.DisplayName() + " - " + ctx.Tr("dashboard")
ctx.Data["PageIsDashboard"] = true
ctx.Data["DisableMirrors"] = setting.Repository.DisableMirrors
ctx.Data["PageIsNews"] = true
ctx.Data["SearchLimit"] = setting.UI.User.RepoPagingNum
// no heatmap access for admins; GetUserHeatmapDataByUser ignores the calling user
Expand Down
11 changes: 3 additions & 8 deletions templates/repo/migrate/git.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@
<input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}">
</div>

<div class="inline field">
<div class="inline field" {{if .DisableMirrors}} hidden{{end}}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just not render this field instead of hiding?

<label>{{.i18n.Tr "repo.migrate_options"}}</label>
<div class="ui checkbox">
{{if .DisableMirrors}}
<input id="mirror" name="mirror" type="checkbox" readonly>
<label>{{.i18n.Tr "repo.migrate_options_mirror_disabled"}}</label>
{{else}}
<input id="mirror" name="mirror" type="checkbox" {{if .mirror}}checked{{end}}>
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
{{end}}
<input id="mirror" name="mirror" type="checkbox"{{if and (not .DisableMirrors) (.mirror)}} checked{{end}}>
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
</div>
</div>

Expand Down
11 changes: 3 additions & 8 deletions templates/repo/migrate/github.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@
<a target=”_blank” href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token">{{svg "octicon-question"}}</a>
</div>

<div class="inline field">
<div class="inline field" {{if .DisableMirrors}} hidden{{end}}>
<label>{{.i18n.Tr "repo.migrate_options"}}</label>
<div class="ui checkbox">
{{if .DisableMirrors}}
<input id="mirror" name="mirror" type="checkbox" readonly>
<label>{{.i18n.Tr "repo.migrate_options_mirror_disabled"}}</label>
{{else}}
<input id="mirror" name="mirror" type="checkbox" {{if .mirror}}checked{{end}}>
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
{{end}}
<input id="mirror" name="mirror" type="checkbox"{{if and (not .DisableMirrors) (.mirror)}} checked{{end}}>
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
</div>
</div>

Expand Down
11 changes: 3 additions & 8 deletions templates/repo/migrate/gitlab.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@
<a target=”_blank” href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html">{{svg "octicon-question"}}</a>
</div>

<div class="inline field">
<div class="inline field" {{if .DisableMirrors}} hidden{{end}}>
<label>{{.i18n.Tr "repo.migrate_options"}}</label>
<div class="ui checkbox">
{{if .DisableMirrors}}
<input id="mirror" name="mirror" type="checkbox" readonly>
<label>{{.i18n.Tr "repo.migrate_options_mirror_disabled"}}</label>
{{else}}
<input id="mirror" name="mirror" type="checkbox" {{if .mirror}}checked{{end}}>
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
{{end}}
<input id="mirror" name="mirror" type="checkbox"{{if and (not .DisableMirrors) (.mirror)}} checked{{end}}>
<label>{{.i18n.Tr "repo.migrate_options_mirror_helper" | Safe}}</label>
</div>
</div>

Expand Down
10 changes: 6 additions & 4 deletions templates/user/dashboard/repolist.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@
{{.i18n.Tr "forks"}}
<div v-show="reposFilter === 'forks'" class="ui circular mini grey label">${repoTypeCount}</div>
</a>
<a class="item" :class="{active: reposFilter === 'mirrors'}" @click="changeReposFilter('mirrors')">
{{.i18n.Tr "mirrors"}}
<div v-show="reposFilter === 'mirrors'" class="ui circular mini grey label">${repoTypeCount}</div>
</a>
{{if not .DisableMirrors}}
<a class="item" :class="{active: reposFilter === 'mirrors'}" @click="changeReposFilter('mirrors')">
{{.i18n.Tr "mirrors"}}
<div v-show="reposFilter === 'mirrors'" class="ui circular mini grey label">${repoTypeCount}</div>
</a>
{{end}}
<a class="item" :class="{active: reposFilter === 'collaborative'}" @click="changeReposFilter('collaborative')">
{{.i18n.Tr "collaborative"}}
<div v-show="reposFilter === 'collaborative'" class="ui circular mini grey label">${repoTypeCount}</div>
Expand Down