feat: support disable bots completely

This commit is contained in:
Jason Song
2022-12-01 15:27:28 +08:00
parent ab69fdc6fe
commit b2745bff43
8 changed files with 33 additions and 23 deletions

View File

@@ -32,8 +32,10 @@
{{.locale.Tr "repo.settings.lfs"}}
</a>
{{end}}
<a class="{{if .PageIsSettingsRunners}}active{{end}} item" href="{{.RepoLink}}/settings/runners">
{{.locale.Tr "repo.settings.runners"}}
</a>
{{if and .EnableBots (not .UnitBotsGlobalDisabled) (.Permission.CanRead $.UnitTypeBots)}}
<a class="{{if .PageIsSettingsRunners}}active{{end}} item" href="{{.RepoLink}}/settings/runners">
{{.locale.Tr "repo.settings.runners"}}
</a>
{{end}}
</div>
</div>

View File

@@ -420,18 +420,20 @@
</div>
</div>
{{$isBotsEnabled := .Repository.UnitEnabled $.UnitTypeBots}}
<div class="inline field">
<label>{{.locale.Tr "repo.bots"}}</label>
{{if .UnitTypeBots.UnitGlobalDisabled}}
<div class="ui checkbox tooltip disabled" data-content="{{.locale.Tr "repo.unit_disabled"}}">
{{else}}
<div class="ui checkbox">
{{end}}
<input class="enable-system" name="enable_bots" type="checkbox" {{if $isBotsEnabled}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.bots_desc"}}</label>
{{if .EnableBots }}
{{$isBotsEnabled := .Repository.UnitEnabled $.UnitTypeBots}}
<div class="inline field">
<label>{{.locale.Tr "repo.bots"}}</label>
{{if .UnitTypeBots.UnitGlobalDisabled}}
<div class="ui checkbox tooltip disabled" data-content="{{.locale.Tr "repo.unit_disabled"}}">
{{else}}
<div class="ui checkbox">
{{end}}
<input class="enable-system" name="enable_bots" type="checkbox" {{if $isBotsEnabled}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.bots_desc"}}</label>
</div>
</div>
</div>
{{end}}
{{if not .IsMirror}}
<div class="ui divider"></div>