loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix "force private" logic (#31012)

When creating a repo, the "FORCE_PRIVATE" config option should be
respected, `readonly` doesn't work for checkbox, so it should use
`disabled` attribute.

(cherry picked from commit edbf74c418061b013a5855f604dd6be6baf34132)

Conflicts:
templates/repo/create.tmpl
templates/repo/migrate/codebase.tmpl
templates/repo/migrate/git.tmpl
templates/repo/migrate/gitbucket.tmpl
templates/repo/migrate/gitea.tmpl
templates/repo/migrate/github.tmpl
templates/repo/migrate/gitlab.tmpl
templates/repo/migrate/gogs.tmpl
templates/repo/migrate/onedev.tmpl
already in forgejo fc0c5e80da Fix and improve repo visibility checkbox when FORCE_PRIVATE is on (#3786)
enforcing FORCE_PRIVATE on repo settings was manually tested
with a repository of an unprivileged user after setting
FORCE_PRIVATE = true

authored by

wxiaoguang and committed by
Earl Warren
a649610d 4d30a490

+10 -9
+1 -1
routers/api/v1/repo/migrate.go
··· 175 175 Description: opts.Description, 176 176 OriginalURL: form.CloneAddr, 177 177 GitServiceType: gitServiceType, 178 - IsPrivate: opts.Private, 178 + IsPrivate: opts.Private || setting.Repository.ForcePrivate, 179 179 IsMirror: opts.Mirror, 180 180 Status: repo_model.RepositoryBeingMigrated, 181 181 })
+2 -2
routers/api/v1/repo/repo.go
··· 252 252 Gitignores: opt.Gitignores, 253 253 License: opt.License, 254 254 Readme: opt.Readme, 255 - IsPrivate: opt.Private, 255 + IsPrivate: opt.Private || setting.Repository.ForcePrivate, 256 256 AutoInit: opt.AutoInit, 257 257 DefaultBranch: opt.DefaultBranch, 258 258 TrustModel: repo_model.ToTrustModel(opt.TrustModel), ··· 364 364 Name: form.Name, 365 365 DefaultBranch: form.DefaultBranch, 366 366 Description: form.Description, 367 - Private: form.Private, 367 + Private: form.Private || setting.Repository.ForcePrivate, 368 368 GitContent: form.GitContent, 369 369 Topics: form.Topics, 370 370 GitHooks: form.GitHooks,
+1 -1
routers/web/repo/repo.go
··· 248 248 opts := repo_service.GenerateRepoOptions{ 249 249 Name: form.RepoName, 250 250 Description: form.Description, 251 - Private: form.Private, 251 + Private: form.Private || setting.Repository.ForcePrivate, 252 252 GitContent: form.GitContent, 253 253 Topics: form.Topics, 254 254 GitHooks: form.GitHooks,
+1 -1
services/migrations/gitea_uploader.go
··· 107 107 Description: repo.Description, 108 108 OriginalURL: repo.OriginalURL, 109 109 GitServiceType: opts.GitServiceType, 110 - IsPrivate: opts.Private, 110 + IsPrivate: opts.Private || setting.Repository.ForcePrivate, 111 111 IsMirror: opts.Mirror, 112 112 Status: repo_model.RepositoryBeingMigrated, 113 113 })
+1 -1
services/repository/repository.go
··· 85 85 86 86 repo, err := CreateRepository(ctx, authUser, owner, CreateRepoOptions{ 87 87 Name: repoName, 88 - IsPrivate: setting.Repository.DefaultPushCreatePrivate, 88 + IsPrivate: setting.Repository.DefaultPushCreatePrivate || setting.Repository.ForcePrivate, 89 89 }) 90 90 if err != nil { 91 91 return nil, err
+1 -1
services/task/task.go
··· 107 107 Description: opts.Description, 108 108 OriginalURL: opts.OriginalURL, 109 109 GitServiceType: opts.GitServiceType, 110 - IsPrivate: opts.Private, 110 + IsPrivate: opts.Private || setting.Repository.ForcePrivate, 111 111 IsMirror: opts.Mirror, 112 112 Status: repo_model.RepositoryBeingMigrated, 113 113 })
+3 -2
templates/repo/settings/options.tmpl
··· 28 28 <label>{{ctx.Locale.Tr "repo.visibility"}}</label> 29 29 <div class="ui checkbox" {{if and (not .Repository.IsPrivate) (gt .Repository.NumStars 0)}}data-tooltip-content="{{ctx.Locale.Tr "repo.stars_remove_warning"}}"{{end}}> 30 30 {{if .IsAdmin}} 31 - <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}> 31 + <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}> 32 32 {{else}} 33 - <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}{{if and $.ForcePrivate .Repository.IsPrivate}} readonly{{end}}> 33 + <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}{{if and $.ForcePrivate .Repository.IsPrivate}} disabled{{end}}> 34 + {{if and .Repository.IsPrivate $.ForcePrivate}}<input type="hidden" name="private" value="{{.Repository.IsPrivate}}">{{end}} 34 35 {{end}} 35 36 <label>{{ctx.Locale.Tr "repo.visibility_helper"}} {{if .Repository.NumForks}}<span class="text red">{{ctx.Locale.Tr "repo.visibility_fork_helper"}}</span>{{end}}</label> 36 37 </div>