Skip to content

Commit 6801919

Browse files
committed
Disable unnecessary GitHooks elements
This mod fixes disabling unnecessary GitHooks elements. Related: go-gitea#13129 Author-Change-Id: IB#1115251
1 parent b7c6457 commit 6801919

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

services/cron/tasks_extended.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ func initExtendedTasks() {
160160
registerGarbageCollectRepositories()
161161
registerRewriteAllPublicKeys()
162162
registerRewriteAllPrincipalKeys()
163-
registerRepositoryUpdateHook()
163+
if !setting.DisableGitHooks {
164+
registerRepositoryUpdateHook()
165+
}
164166
registerReinitMissingRepositories()
165167
registerDeleteMissingRepositories()
166168
registerRemoveRandomAvatars()

templates/admin/dashboard.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@
5252
<td><button type="submit" class="ui green button" name="op" value="resync_all_sshprincipals">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
5353
</tr>
5454
{{end}}
55+
{{if not DisableGitHooks}}
5556
<tr>
5657
<td>{{.i18n.Tr "admin.dashboard.resync_all_hooks"}}</td>
5758
<td><button type="submit" class="ui green button" name="op" value="resync_all_hooks">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
5859
</tr>
60+
{{end}}
5961
<tr>
6062
<td>{{.i18n.Tr "admin.dashboard.reinit_missing_repos"}}</td>
6163
<td><button type="submit" class="ui green button" name="op" value="reinit_missing_repos">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>

templates/admin/user/edit.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<input name="restricted" type="checkbox" {{if .User.IsRestricted}}checked{{end}}>
117117
</div>
118118
</div>
119-
<div class="inline field">
119+
<div class="inline field"{{if DisableGitHooks}} hidden{{end}}>
120120
<div class="ui checkbox tooltip" data-content="{{.i18n.Tr "admin.users.allow_git_hook_tooltip"}}" data-variation="very wide">
121121
<label><strong>{{.i18n.Tr "admin.users.allow_git_hook"}}</strong></label>
122122
<input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}>

0 commit comments

Comments
 (0)