Add group-level callout for disabled webhooks
What does this MR do and why?
- This adds the frontend code for a group-wide alert (visible to owner / maintainer) when a webhook fails for some reason.
- Once a user dismisses it, it should not show again (persistent user callout functionality).
- The alert does not show on the webhook page itself or on the webhook logs page.
Changelog: changed
EE: true
There is a similar MR for the project-level alert !95998 (merged).
Screenshots or screen recordings
How to set up and validate locally
- Go to Group > Settings > Webhook and create a webhook (you can use any valid URL).
- Mark the webhook as temporary disabled by running this in your
bin/rails console
:
g = GroupHook.last
g.recent_failures = 5
g.disabled_until = Time.now + 1.month
g.save
- Force show the alert with this diff:
diff --git a/app/models/users/group_callout.rb b/app/models/users/group_callout.rb
index 2552407fa4cd..1e2afdc28d51 100644
--- a/app/models/users/group_callout.rb
+++ b/app/models/users/group_callout.rb
@@ -24,7 +24,8 @@ class GroupCallout < ApplicationRecord
namespace_storage_limit_banner_error_threshold: 13, # EE-only
usage_quota_trial_alert: 14, # EE-only
preview_usage_quota_free_plan_alert: 15, # EE-only
- enforcement_at_limit_alert: 16 # EE-only
+ enforcement_at_limit_alert: 16, # EE-only
+ web_hook_disabled: 17 # EE-only
}
validates :group, presence: true
diff --git a/ee/app/helpers/ee/web_hooks/web_hooks_helper.rb b/ee/app/helpers/ee/web_hooks/web_hooks_helper.rb
index 494bc362fe6e..20759559f899 100644
--- a/ee/app/helpers/ee/web_hooks/web_hooks_helper.rb
+++ b/ee/app/helpers/ee/web_hooks/web_hooks_helper.rb
@@ -42,7 +42,7 @@ def show_group_hook_failed_callout?(group)
return false if group_hook_page?
return false unless current_user
- false # More conditions / logic to be added before showing this callout
+ true # More conditions / logic to be added before showing this callout
end
def group_hook_page?
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #385902 (closed)
Edited by Justin Ho Tuan Duong