From e5b0066559404cc4e2337c051ca5370f71d076b2 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 23 Sep 2023 12:10:01 +0000 Subject: [PATCH] Disable `Test Delivery` and `Replay` webhook buttons when webhook is inactive These buttons are now disabled when the webhook is not active. Signed-off-by: Yarden Shoham --- options/locale/locale_en-US.ini | 2 ++ templates/repo/settings/webhook/history.tmpl | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 74b8931de88ae..a6ae0cbf1f962 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2133,12 +2133,14 @@ settings.webhook_deletion_desc = Removing a webhook deletes its settings and del settings.webhook_deletion_success = The webhook has been removed. settings.webhook.test_delivery = Test Delivery settings.webhook.test_delivery_desc = Test this webhook with a fake event. +settings.webhook.test_delivery_desc_disabled = To test this webhook with a fake event, activate it. settings.webhook.request = Request settings.webhook.response = Response settings.webhook.headers = Headers settings.webhook.payload = Content settings.webhook.body = Body settings.webhook.replay.description = Replay this webhook. +settings.webhook.replay.description_disabled = To replay this webhook, activate it. settings.webhook.delivery.success = An event has been added to the delivery queue. It may take few seconds before it shows up in the delivery history. settings.githooks_desc = "Git Hooks are powered by Git itself. You can edit hook files below to set up custom operations." settings.githook_edit_desc = If the hook is inactive, sample content will be presented. Leaving content to an empty value will disable this hook. diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl index 07d6f4bede714..69e50989e618d 100644 --- a/templates/repo/settings/webhook/history.tmpl +++ b/templates/repo/settings/webhook/history.tmpl @@ -1,9 +1,13 @@ +{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}} {{if .PageIsSettingsHooksEdit}}

{{.locale.Tr "repo.settings.recent_deliveries"}} {{if .Permission.IsAdmin}}
- + + + +
{{end}}

@@ -43,7 +47,9 @@ {{end}}