Skip to content

Commit

Permalink
Hiding Secrets options when Actions feature is disabled (go-gitea#24792)
Browse files Browse the repository at this point in the history
`Secrets` options should be hidden if `Actions` feature is disabled.

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

Fixes: 6590551
Author-Change-Id: IB#1134011

Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
  • Loading branch information
pboguslawski authored May 24, 2023
1 parent 275abd6 commit c5dee88
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func RegisterRoutes(m *web.Route) {
m.Get("", user_setting.Secrets)
m.Post("", web.Bind(forms.AddSecretForm{}), user_setting.SecretsPost)
m.Post("/delete", user_setting.SecretsDelete)
})
}, actions.MustEnableActions)
m.Get("/organization", user_setting.Organization)
m.Get("/repos", user_setting.Repos)
m.Post("/repos/unadopted", user_setting.AdoptOrDeleteRepository)
Expand Down Expand Up @@ -853,7 +853,7 @@ func RegisterRoutes(m *web.Route) {
m.Get("", org.Secrets)
m.Post("", web.Bind(forms.AddSecretForm{}), org.SecretsPost)
m.Post("/delete", org.SecretsDelete)
})
}, actions.MustEnableActions)

m.Route("/delete", "GET,POST", org.SettingsDelete)

Expand Down Expand Up @@ -1044,7 +1044,7 @@ func RegisterRoutes(m *web.Route) {
m.Get("", repo.Secrets)
m.Post("", web.Bind(forms.AddSecretForm{}), repo.SecretsPost)
m.Post("/delete", repo.DeleteSecret)
})
}, actions.MustEnableActions)

m.Group("/lfs", func() {
m.Get("/", repo.LFSFiles)
Expand Down
2 changes: 2 additions & 0 deletions templates/org/settings/navbar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
<a class="{{if .PageIsOrgSettingsLabels}}active {{end}}item" href="{{.OrgLink}}/settings/labels">
{{.locale.Tr "repo.labels"}}
</a>
{{if .EnableActions}}
<a class="{{if .PageIsOrgSettingsSecrets}}active {{end}}item" href="{{.OrgLink}}/settings/secrets">
{{.locale.Tr "secrets.secrets"}}
</a>
{{end}}
{{if .EnableOAuth2}}
<a class="{{if .PageIsSettingsApplications}}active {{end}}item" href="{{.OrgLink}}/settings/applications">
{{.locale.Tr "settings.applications"}}
Expand Down
2 changes: 2 additions & 0 deletions templates/repo/settings/nav.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<li {{if .PageIsSettingsGitHooks}}class="current"{{end}}><a href="{{.RepoLink}}/settings/hooks/git">{{.locale.Tr "repo.settings.githooks"}}</a></li>
{{end}}
<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>
{{end}}
</ul>
</div>
</div>
2 changes: 2 additions & 0 deletions templates/repo/settings/navbar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
<a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{.RepoLink}}/settings/keys">
{{.locale.Tr "repo.settings.deploy_keys"}}
</a>
{{if .EnableActions}}
<a class="{{if .PageIsSettingsSecrets}}active {{end}}item" href="{{.RepoLink}}/settings/secrets">
{{.locale.Tr "secrets.secrets"}}
</a>
{{end}}
{{if .LFSStartServer}}
<a class="{{if .PageIsSettingsLFS}}active {{end}}item" href="{{.RepoLink}}/settings/lfs">
{{.locale.Tr "repo.settings.lfs"}}
Expand Down
2 changes: 2 additions & 0 deletions templates/user/settings/navbar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
<a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{AppSubUrl}}/user/settings/keys">
{{.locale.Tr "settings.ssh_gpg_keys"}}
</a>
{{if .EnableActions}}
<a class="{{if .PageIsSettingsSecrets}}active {{end}}item" href="{{AppSubUrl}}/user/settings/secrets">
{{.locale.Tr "secrets.secrets"}}
</a>
{{end}}
{{if .EnablePackages}}
<a class="{{if .PageIsSettingsPackages}}active {{end}}item" href="{{AppSubUrl}}/user/settings/packages">
{{.locale.Tr "packages.title"}}
Expand Down

0 comments on commit c5dee88

Please sign in to comment.