Fixes an visual bug where the info box to dispatch a workflow is shown even for users that lack permissions to actualy run the workflow. (#4305)
Example: Visit https://v8.next.forgejo.org/Mai-Lapyst/test/actions?workflow=dispatch.yaml&actor=0&status=0 without being logged in.  Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4305 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org> Co-committed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
This commit is contained in:
parent
c49afdf0ff
commit
98c8d45f0b
2 changed files with 13 additions and 2 deletions
|
@ -95,6 +95,8 @@ func List(ctx *context.Context) {
|
|||
allRunnerLabels.AddMultiple(r.AgentLabels...)
|
||||
}
|
||||
|
||||
canRun := ctx.Repo.CanWrite(unit.TypeActions)
|
||||
|
||||
workflows = make([]Workflow, 0, len(entries))
|
||||
for _, entry := range entries {
|
||||
workflow := Workflow{Entry: *entry}
|
||||
|
@ -146,7 +148,7 @@ func List(ctx *context.Context) {
|
|||
}
|
||||
workflows = append(workflows, workflow)
|
||||
|
||||
if workflow.Entry.Name() == curWorkflow {
|
||||
if canRun && workflow.Entry.Name() == curWorkflow {
|
||||
config := wf.WorkflowDispatchConfig()
|
||||
if config != nil {
|
||||
keys := util.KeysOfMap(config.Inputs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue