diff --git a/src/api/app/controllers/webui/users/subscriptions_controller.rb b/src/api/app/controllers/webui/users/subscriptions_controller.rb index 53c848513cb..a5966fb079b 100644 --- a/src/api/app/controllers/webui/users/subscriptions_controller.rb +++ b/src/api/app/controllers/webui/users/subscriptions_controller.rb @@ -2,7 +2,7 @@ class Webui::Users::SubscriptionsController < Webui::WebuiController before_action :require_login def index - switch_to_webui2 if User.current.try(:in_beta?) && Rails.env.development? + switch_to_webui2 @user = User.current @groups_users = User.current.groups_users diff --git a/src/api/app/views/webui/subscriptions/_subscriptions_form.html.haml b/src/api/app/views/webui/subscriptions/_subscriptions_form.html.haml index 50cb721e68f..77f25a2b4f5 100644 --- a/src/api/app/views/webui/subscriptions/_subscriptions_form.html.haml +++ b/src/api/app/views/webui/subscriptions/_subscriptions_form.html.haml @@ -9,7 +9,7 @@ = fields_for "subscriptions[#{i}]", subscription do |f| %li = f.check_box :channel, { data: { eventtype: subscription.eventtype, receiver_role: subscription.receiver_role } }, EventSubscription.channels.keys[1], EventSubscription.channels.keys[0] - = f.label :receive, EventSubscription::RECEIVER_ROLE_TEXTS[subscription.receiver_role] + = f.label :channel, EventSubscription::RECEIVER_ROLE_TEXTS[subscription.receiver_role] = f.hidden_field :eventtype = f.hidden_field :receiver_role - i += 1 diff --git a/src/api/app/views/webui2/webui/subscriptions/_subscriptions_form.html.haml b/src/api/app/views/webui2/webui/subscriptions/_subscriptions_form.html.haml index d6fb7c8df0d..23ef10e4c02 100644 --- a/src/api/app/views/webui2/webui/subscriptions/_subscriptions_form.html.haml +++ b/src/api/app/views/webui2/webui/subscriptions/_subscriptions_form.html.haml @@ -8,10 +8,9 @@ - subscriptions.each do |subscription| = fields_for "subscriptions[#{i}]", subscription do |f| .custom-control.custom-checkbox.custom-control-inline - = f.check_box :channel, { id: "#{i}", class: 'custom-control-input', data: { eventtype: subscription.eventtype, + = f.check_box :channel, { class: 'custom-control-input', data: { eventtype: subscription.eventtype, receiver_role: subscription.receiver_role } }, EventSubscription.channels.keys[1], EventSubscription.channels.keys[0] - = f.label :receive, EventSubscription::RECEIVER_ROLE_TEXTS[subscription.receiver_role], class: 'custom-control-label', - for: "#{i}" + = f.label :channel, EventSubscription::RECEIVER_ROLE_TEXTS[subscription.receiver_role], class: 'custom-control-label' = f.hidden_field :eventtype = f.hidden_field :receiver_role - i += 1 diff --git a/src/api/spec/features/webui/notifications_spec.rb b/src/api/spec/features/webui/notifications_spec.rb index 8eaee159f35..03718fa2f0b 100644 --- a/src/api/spec/features/webui/notifications_spec.rb +++ b/src/api/spec/features/webui/notifications_spec.rb @@ -7,14 +7,14 @@ visit path expect(page).to have_content(title) - [ ['Event::CommentForPackage', 'commenter'], ['Event::CommentForProject', 'maintainer'], ['Event::CommentForRequest', 'reviewer'], ['Event::BuildFail', 'maintainer'] ].each do |eventtype, receiver_role| - find("input[data-eventtype='#{eventtype}'][data-receiver-role='#{receiver_role}']").set(true) + # `visible: :all` and `allow_label_click: true` are needed for Bootstrap (as the checkboxes aren't found otherwise) + find("input[data-eventtype='#{eventtype}'][data-receiver-role='#{receiver_role}']", visible: :all).check(allow_label_click: true) end click_button 'Update' diff --git a/src/api/spec/features/webui/users/users_notifications_settings_spec.rb b/src/api/spec/features/webui/users/users_notifications_settings_spec.rb index b9fe2e2ede2..72d4c925c7e 100644 --- a/src/api/spec/features/webui/users/users_notifications_settings_spec.rb +++ b/src/api/spec/features/webui/users/users_notifications_settings_spec.rb @@ -9,11 +9,13 @@ group_title = user_with_groups.groups.first.title expect(page).to have_content 'You will receive emails from the checked groups' - expect(page).to have_checked_field(group_title) - uncheck group_title + # Using `visible: :all` for the Bootstrap version (as the checkboxes aren't found otherwise) + expect(page).to have_checked_field(group_title, visible: :all) + uncheck(group_title, allow_label_click: true) click_button 'Update' expect(page).to have_content 'Notifications settings updated' expect(page).to have_content 'You will receive emails from the checked groups' - expect(page).to have_unchecked_field(group_title) + # Using `visible: :all` for the Bootstrap version (as the checkboxes aren't found otherwise) + expect(page).to have_unchecked_field(group_title, visible: :all) end end