Commit 63b83e8f authored by Jacopo's avatar Jacopo

Add an helper to check if a notification_event is enabled

Introduce event_disabled?(event) helper to check if a specific
notification event is disabled.
parent 0be43dbe
...@@ -120,4 +120,8 @@ module NotificationsHelper ...@@ -120,4 +120,8 @@ module NotificationsHelper
def can_read_project?(project) def can_read_project?(project)
can?(current_user, :read_project, project) can?(current_user, :read_project, project)
end end
def notification_event_disabled?(event)
event == :fixed_pipeline && Feature.disabled?(:ci_pipeline_fixed_notifications)
end
end end
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#{ paragraph.html_safe } #{ paragraph.html_safe }
.col-lg-8 .col-lg-8
- notification_setting.email_events.each_with_index do |event, index| - notification_setting.email_events.each_with_index do |event, index|
- next if event == :fixed_pipeline && Feature.disabled?(:ci_pipeline_fixed_notifications) - next if notification_event_disabled?(event)
- field_id = "#{notifications_menu_identifier("modal", notification_setting)}_notification_setting[#{event}]" - field_id = "#{notifications_menu_identifier("modal", notification_setting)}_notification_setting[#{event}]"
.form-group .form-group
.form-check{ class: ("prepend-top-0" if index == 0) } .form-check{ class: ("prepend-top-0" if index == 0) }
......
---
title: Add an helper to check if a notification_event is enabled
merge_request: 27880
author: Jacopo Beschi @jacopo-beschi
type: changed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment