mirror of https://github.com/gogs/gogs.git
repo: disable public access option when using external wiki and issue tracker (#6081)
parent
5b36ba66c2
commit
3e055e329c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -156,6 +156,13 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|||
repo.PullsIgnoreWhitespace = f.PullsIgnoreWhitespace
|
||||
repo.PullsAllowRebase = f.PullsAllowRebase
|
||||
|
||||
if !repo.EnableWiki || repo.EnableExternalWiki {
|
||||
repo.AllowPublicWiki = false
|
||||
}
|
||||
if !repo.EnableIssues || repo.EnableExternalTracker {
|
||||
repo.AllowPublicIssues = false
|
||||
}
|
||||
|
||||
if err := db.UpdateRepository(repo, false); err != nil {
|
||||
c.Error(err, "update repository")
|
||||
return
|
||||
|
|
|
@ -1621,11 +1621,13 @@ $(document).ready(function() {
|
|||
$($(this).data("target")).removeClass("disabled");
|
||||
} else {
|
||||
$($(this).data("target")).addClass("disabled");
|
||||
$($(this).data("uncheck")).prop("checked", false);
|
||||
}
|
||||
});
|
||||
$(".enable-system-radio").change(function() {
|
||||
$($(this).data("enable")).removeClass("disabled");
|
||||
$($(this).data("disable")).addClass("disabled");
|
||||
$($(this).data("uncheck")).prop("checked", false);
|
||||
});
|
||||
|
||||
// Set anchor.
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.wiki"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input class="enable-system" type="checkbox" name="enable_wiki" data-target="#wiki_box" {{if .Repository.EnableWiki}}checked{{end}}>
|
||||
<input class="enable-system" type="checkbox" name="enable_wiki" data-target="#wiki_box" data-uncheck="input[name='allow_public_wiki']" {{if .Repository.EnableWiki}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.settings.wiki_desc"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -136,7 +136,7 @@
|
|||
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-enable="#external_wiki_box" data-disable="#internal_wiki_box" {{if .Repository.EnableExternalWiki}}checked{{end}}/>
|
||||
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-enable="#external_wiki_box" data-disable="#internal_wiki_box" data-uncheck="input[name='allow_public_wiki']" {{if .Repository.EnableExternalWiki}}checked{{end}}/>
|
||||
<label>{{.i18n.Tr "repo.settings.use_external_wiki"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -151,7 +151,7 @@
|
|||
<div class="inline field">
|
||||
<label>{{.i18n.Tr "repo.issues"}}</label>
|
||||
<div class="ui checkbox">
|
||||
<input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if .Repository.EnableIssues}}checked{{end}}>
|
||||
<input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" data-uncheck="input[name='allow_public_issues']" {{if .Repository.EnableIssues}}checked{{end}}>
|
||||
<label>{{.i18n.Tr "repo.settings.issues_desc"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -171,7 +171,7 @@
|
|||
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-enable="#external_issue_box" data-disable="#internal_issue_box" {{if .Repository.EnableExternalTracker}}checked{{end}}/>
|
||||
<input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-enable="#external_issue_box" data-disable="#internal_issue_box" data-uncheck="input[name='allow_public_issues']" {{if .Repository.EnableExternalTracker}}checked{{end}}/>
|
||||
<label>{{.i18n.Tr "repo.settings.use_external_issue_tracker"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue