From 69b1c5e4f799b996e0f488e4cdcddadbe378e710 Mon Sep 17 00:00:00 2001 From: "Claire.Nicholas" Date: Mon, 29 Jan 2024 13:29:50 -0600 Subject: [PATCH] fix: working with new changes with secrets/allowEvents --- src/elm/Pages/RepoSettings.elm | 4 ++-- src/elm/Pages/Secrets/Form.elm | 13 +++++++++++++ src/elm/Pages/Secrets/Update.elm | 6 ++++++ src/elm/Pages/Secrets/View.elm | 2 ++ src/elm/Vela.elm | 2 +- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/elm/Pages/RepoSettings.elm b/src/elm/Pages/RepoSettings.elm index 0ce7a732b..d16303ad6 100644 --- a/src/elm/Pages/RepoSettings.elm +++ b/src/elm/Pages/RepoSettings.elm @@ -372,12 +372,12 @@ events repo msg = , div [ class "form-controls", class "-two-col" ] [ checkbox "Branch" "allow_push_delete_branch" - allowEvents.push.branch + allowEvents.push.delete_branch <| msg repo.org repo.name repo "allow_push_delete_branch" , checkbox "Tag" "allow_push_delete_tag" - allowEvents.push.tag + allowEvents.push.delete_tag <| msg repo.org repo.name repo "allow_push_delete_tag" ] diff --git a/src/elm/Pages/Secrets/Form.elm b/src/elm/Pages/Secrets/Form.elm index 4d3995ea5..ab72c661e 100644 --- a/src/elm/Pages/Secrets/Form.elm +++ b/src/elm/Pages/Secrets/Form.elm @@ -258,6 +258,19 @@ viewEventsSelect secret model = <| OnChangeEvent "allow_comment_edited" ] + , strong [ class "settings-subtitle" ] [ text "Delete" ] + , div [ class "form-controls", class "-two-col-secrets" ] + [ checkbox "Branch" + "allow_push_delete_branch" + secret.allowEvents.push.delete_branch + <| + OnChangeEvent "allow_push_delete_branch" + , checkbox "Tag" + "allow_push_delete_tag" + secret.allowEvents.push.delete_tag + <| + OnChangeEvent "allow_push_delete_tag" + ] ] scheduleOption ) diff --git a/src/elm/Pages/Secrets/Update.elm b/src/elm/Pages/Secrets/Update.elm index 622d2f39f..8d53aa85c 100644 --- a/src/elm/Pages/Secrets/Update.elm +++ b/src/elm/Pages/Secrets/Update.elm @@ -187,6 +187,12 @@ updateSecretEvents sform field value = "allow_push_tag" -> { sform | allowEvents = { events | push = { pushActions | tag = value } } } + + "allow_push_delete_branch" -> + { sform | allowEvents = { events | push = { pushActions | delete_branch = value } } } + + "allow_push_delete_tag" -> + { sform | allowEvents = { events | push = { pushActions | delete_tag = value } } } "allow_pull_opened" -> { sform | allowEvents = { events | pull = { pullActions | opened = value } } } diff --git a/src/elm/Pages/Secrets/View.elm b/src/elm/Pages/Secrets/View.elm index 6d51897b2..bc4baaf7e 100644 --- a/src/elm/Pages/Secrets/View.elm +++ b/src/elm/Pages/Secrets/View.elm @@ -471,6 +471,8 @@ allowEventsToList events = [] |> appendLabel events.push.branch "push" |> appendLabel events.push.tag "tag" + |> appendLabel events.push.delete_branch "delete:branch" + |> appendLabel events.push.delete_tag "delete:tag" |> appendLabel events.pull.opened "pull_request:opened" |> appendLabel events.pull.synchronize "pull_request:synchronize" |> appendLabel events.pull.edited "pull_request:edited" diff --git a/src/elm/Vela.elm b/src/elm/Vela.elm index 810a9a565..d99b6645b 100644 --- a/src/elm/Vela.elm +++ b/src/elm/Vela.elm @@ -2517,7 +2517,7 @@ secretToKey secret = defaultSecretAllowEvents : AllowEvents defaultSecretAllowEvents = - { push = { branch = True, tag = True }, pull = defaultPullActionsPayload Nothing, deploy = { created = True }, comment = defaultCommentActionsPayload Nothing, schedule = defaultScheduleActionsPayload Nothing } + { push = { branch = True, tag = True, delete_branch = True, delete_tag = True }, pull = defaultPullActionsPayload Nothing, deploy = { created = True }, comment = defaultCommentActionsPayload Nothing, schedule = defaultScheduleActionsPayload Nothing } decodeSecret : Decoder Secret