gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Fix "force private" logic

Open wxiaoguang opened this issue 1 year ago • 2 comments

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

wxiaoguang avatar May 18 '24 11:05 wxiaoguang

There is one more incorrect readonly checkbox, last line here:

$ rg checkbox.+readonly
templates/repo/migrate/gogs.tmpl:106:               <input name="private" type="checkbox" checked readonly>
templates/repo/migrate/gitlab.tmpl:103:               <input name="private" type="checkbox" checked readonly>
templates/repo/migrate/onedev.tmpl:92:                <input name="private" type="checkbox" checked readonly>
templates/repo/migrate/github.tmpl:106:               <input name="private" type="checkbox" checked readonly>
templates/repo/migrate/git.tmpl:66:               <input name="private" type="checkbox" checked readonly>
templates/repo/migrate/gitea.tmpl:104:                <input name="private" type="checkbox" checked readonly>
templates/repo/migrate/gitbucket.tmpl:108:                <input name="private" type="checkbox" checked readonly>
templates/repo/migrate/codebase.tmpl:92:                <input name="private" type="checkbox" checked readonly>
templates/repo/create.tmpl:53:                <input name="private" type="checkbox" checked readonly>
templates/repo/settings/options.tmpl:33:              <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}{{if and $.ForcePrivate .Repository.IsPrivate}} readonly{{end}}>

silverwind avatar May 19 '24 00:05 silverwind

repo/settings/options.tmpl is special, done in new commit

wxiaoguang avatar May 19 '24 01:05 wxiaoguang