Hiding Secrets options when Actions feature is disabled (#24792)

`Secrets` options should be hidden if `Actions` feature is disabled.

This fixes in release/v1.19. In main probably fixed in
63a401ac40 (didn't check).

Fixes: 659055138b
Author-Change-Id: IB#1134011

Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
This commit is contained in:
Paweł Bogusławski 2023-05-24 12:01:11 +02:00 committed by GitHub
parent 275abd6593
commit c5dee8823c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 3 deletions

View file

@ -479,7 +479,7 @@ func RegisterRoutes(m *web.Route) {
m.Get("", user_setting.Secrets) m.Get("", user_setting.Secrets)
m.Post("", web.Bind(forms.AddSecretForm{}), user_setting.SecretsPost) m.Post("", web.Bind(forms.AddSecretForm{}), user_setting.SecretsPost)
m.Post("/delete", user_setting.SecretsDelete) m.Post("/delete", user_setting.SecretsDelete)
}) }, actions.MustEnableActions)
m.Get("/organization", user_setting.Organization) m.Get("/organization", user_setting.Organization)
m.Get("/repos", user_setting.Repos) m.Get("/repos", user_setting.Repos)
m.Post("/repos/unadopted", user_setting.AdoptOrDeleteRepository) m.Post("/repos/unadopted", user_setting.AdoptOrDeleteRepository)
@ -853,7 +853,7 @@ func RegisterRoutes(m *web.Route) {
m.Get("", org.Secrets) m.Get("", org.Secrets)
m.Post("", web.Bind(forms.AddSecretForm{}), org.SecretsPost) m.Post("", web.Bind(forms.AddSecretForm{}), org.SecretsPost)
m.Post("/delete", org.SecretsDelete) m.Post("/delete", org.SecretsDelete)
}) }, actions.MustEnableActions)
m.Route("/delete", "GET,POST", org.SettingsDelete) m.Route("/delete", "GET,POST", org.SettingsDelete)
@ -1044,7 +1044,7 @@ func RegisterRoutes(m *web.Route) {
m.Get("", repo.Secrets) m.Get("", repo.Secrets)
m.Post("", web.Bind(forms.AddSecretForm{}), repo.SecretsPost) m.Post("", web.Bind(forms.AddSecretForm{}), repo.SecretsPost)
m.Post("/delete", repo.DeleteSecret) m.Post("/delete", repo.DeleteSecret)
}) }, actions.MustEnableActions)
m.Group("/lfs", func() { m.Group("/lfs", func() {
m.Get("/", repo.LFSFiles) m.Get("/", repo.LFSFiles)

View file

@ -12,9 +12,11 @@
<a class="{{if .PageIsOrgSettingsLabels}}active {{end}}item" href="{{.OrgLink}}/settings/labels"> <a class="{{if .PageIsOrgSettingsLabels}}active {{end}}item" href="{{.OrgLink}}/settings/labels">
{{.locale.Tr "repo.labels"}} {{.locale.Tr "repo.labels"}}
</a> </a>
{{if .EnableActions}}
<a class="{{if .PageIsOrgSettingsSecrets}}active {{end}}item" href="{{.OrgLink}}/settings/secrets"> <a class="{{if .PageIsOrgSettingsSecrets}}active {{end}}item" href="{{.OrgLink}}/settings/secrets">
{{.locale.Tr "secrets.secrets"}} {{.locale.Tr "secrets.secrets"}}
</a> </a>
{{end}}
{{if .EnableOAuth2}} {{if .EnableOAuth2}}
<a class="{{if .PageIsSettingsApplications}}active {{end}}item" href="{{.OrgLink}}/settings/applications"> <a class="{{if .PageIsSettingsApplications}}active {{end}}item" href="{{.OrgLink}}/settings/applications">
{{.locale.Tr "settings.applications"}} {{.locale.Tr "settings.applications"}}

View file

@ -13,7 +13,9 @@
<li {{if .PageIsSettingsGitHooks}}class="current"{{end}}><a href="{{.RepoLink}}/settings/hooks/git">{{.locale.Tr "repo.settings.githooks"}}</a></li> <li {{if .PageIsSettingsGitHooks}}class="current"{{end}}><a href="{{.RepoLink}}/settings/hooks/git">{{.locale.Tr "repo.settings.githooks"}}</a></li>
{{end}} {{end}}
<li {{if .PageIsSettingsKeys}}class="current"{{end}}><a href="{{.RepoLink}}/settings/keys">{{.locale.Tr "repo.settings.deploy_keys"}}</a></li> <li {{if .PageIsSettingsKeys}}class="current"{{end}}><a href="{{.RepoLink}}/settings/keys">{{.locale.Tr "repo.settings.deploy_keys"}}</a></li>
{{if .EnableActions}}
<li {{if .PageIsSettingsSecrets}}class="current"{{end}}><a href="{{.RepoLink}}/settings/secrets">{{.locale.Tr "secrets.secrets"}}</a></li> <li {{if .PageIsSettingsSecrets}}class="current"{{end}}><a href="{{.RepoLink}}/settings/secrets">{{.locale.Tr "secrets.secrets"}}</a></li>
{{end}}
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -27,9 +27,11 @@
<a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{.RepoLink}}/settings/keys"> <a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{.RepoLink}}/settings/keys">
{{.locale.Tr "repo.settings.deploy_keys"}} {{.locale.Tr "repo.settings.deploy_keys"}}
</a> </a>
{{if .EnableActions}}
<a class="{{if .PageIsSettingsSecrets}}active {{end}}item" href="{{.RepoLink}}/settings/secrets"> <a class="{{if .PageIsSettingsSecrets}}active {{end}}item" href="{{.RepoLink}}/settings/secrets">
{{.locale.Tr "secrets.secrets"}} {{.locale.Tr "secrets.secrets"}}
</a> </a>
{{end}}
{{if .LFSStartServer}} {{if .LFSStartServer}}
<a class="{{if .PageIsSettingsLFS}}active {{end}}item" href="{{.RepoLink}}/settings/lfs"> <a class="{{if .PageIsSettingsLFS}}active {{end}}item" href="{{.RepoLink}}/settings/lfs">
{{.locale.Tr "repo.settings.lfs"}} {{.locale.Tr "repo.settings.lfs"}}

View file

@ -18,9 +18,11 @@
<a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{AppSubUrl}}/user/settings/keys"> <a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{AppSubUrl}}/user/settings/keys">
{{.locale.Tr "settings.ssh_gpg_keys"}} {{.locale.Tr "settings.ssh_gpg_keys"}}
</a> </a>
{{if .EnableActions}}
<a class="{{if .PageIsSettingsSecrets}}active {{end}}item" href="{{AppSubUrl}}/user/settings/secrets"> <a class="{{if .PageIsSettingsSecrets}}active {{end}}item" href="{{AppSubUrl}}/user/settings/secrets">
{{.locale.Tr "secrets.secrets"}} {{.locale.Tr "secrets.secrets"}}
</a> </a>
{{end}}
{{if .EnablePackages}} {{if .EnablePackages}}
<a class="{{if .PageIsSettingsPackages}}active {{end}}item" href="{{AppSubUrl}}/user/settings/packages"> <a class="{{if .PageIsSettingsPackages}}active {{end}}item" href="{{AppSubUrl}}/user/settings/packages">
{{.locale.Tr "packages.title"}} {{.locale.Tr "packages.title"}}