OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Rename component to EmailUpdatesModeSelectorComponent
Mir Bhatia4f150b6d64ce
diff --git a/app/components/op_primer/email_updates_switch_component.html.erb b/app/components/op_primer/email_updates_mode_selector_component.html.erbsimilarity index 93%rename from app/components/op_primer/email_updates_switch_component.html.erbrename to app/components/op_primer/email_updates_mode_selector_component.html.erbindex da18d22d098..ec021eba89a 100644--- a/app/components/op_primer/email_updates_switch_component.html.erb+++ b/app/components/op_primer/email_updates_mode_selector_component.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%=- component_wrapper(data: { "test-selector": "email-updates-switch" }) do+ component_wrapper(data: { "test-selector": "email-updates-mode-selector" }) dorender(Primer::OpenProject::SidePanel::Section.new) do |section|section.with_title { @title }@@ -38,7 +38,7 @@ See COPYRIGHT and LICENSE files for more details.tag: :a,href: @path,classes: "hide-when-print",- data: { "turbo-stream": true, "turbo-method": @method, "test-selector": "email-updates-switch-button" }+ data: { "turbo-stream": true, "turbo-method": @method, "test-selector": "email-updates-mode-selector-button" }) do |button|button.with_leading_visual_icon(icon: button_icon)button_labeldiff --git a/app/components/op_primer/email_updates_switch_component.rb b/app/components/op_primer/email_updates_mode_selector_component.rbsimilarity index 95%rename from app/components/op_primer/email_updates_switch_component.rbrename to app/components/op_primer/email_updates_mode_selector_component.rbindex d9ca572d476..d734537e663 100644--- a/app/components/op_primer/email_updates_switch_component.rb+++ b/app/components/op_primer/email_updates_mode_selector_component.rb@@ -29,7 +29,7 @@#++module OpPrimer- class EmailUpdatesSwitchComponent < Primer::Component # rubocop:disable OpenProject/AddPreviewForViewComponent+ class EmailUpdatesModeSelectorComponent < Primer::Component # rubocop:disable OpenProject/AddPreviewForViewComponentinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpersdiff --git a/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb b/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erbdeleted file mode 100644index 24c8730cef2..00000000000--- a/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb+++ /dev/null@@ -1,62 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2013 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See COPYRIGHT and LICENSE files for more details.--++#%>--<%=- component_wrapper(data: { "test-selector": "notifications-button" }) do- render(Primer::OpenProject::SidePanel::Section.new) do |section|- section.with_title { I18n.t("meeting.notifications.sidepanel.title") }-- if show_button?- section.with_footer_button(- color: :accent,- tag: :a,- href: toggle_notifications_dialog_project_meeting_path(@project, @meeting),- classes: "hide-when-print",- data: { "turbo-stream": true }- ) do |button|- button.with_leading_visual_icon(icon: button_icon)- button_label- end- end-- flex_layout do |flex|- flex.with_row do- concat(render(Primer::Beta::Text.new(font_weight: :semibold, color: :subtle)) { "#{state} " })- concat(render(Primer::Beta::Text.new(color: :subtle)) { description })- end-- unless show_button?- flex.with_row(mt: 2) do- render(Primer::Beta::Text.new(color: :subtle)) { additional_text }- end- end- end- end- end-%>diff --git a/modules/meeting/app/components/meetings/side_panel_component.html.erb b/modules/meeting/app/components/meetings/side_panel_component.html.erbindex 1efea7baf4b..77f9fd37097 100644--- a/modules/meeting/app/components/meetings/side_panel_component.html.erb+++ b/modules/meeting/app/components/meetings/side_panel_component.html.erb@@ -4,7 +4,7 @@panel.with_section(Meetings::SidePanel::DetailsComponent.new(meeting: @meeting))if @meeting.editable?- panel.with_section(email_updates_switch)+ panel.with_section(email_updates_mode_selector)endunless @meeting.template?diff --git a/modules/meeting/app/components/meetings/side_panel_component.rb b/modules/meeting/app/components/meetings/side_panel_component.rbindex 0148b031c93..ab0c1a6de0b 100644--- a/modules/meeting/app/components/meetings/side_panel_component.rb+++ b/modules/meeting/app/components/meetings/side_panel_component.rb@@ -41,8 +41,8 @@ module Meetingsprivate- def email_updates_switch- OpPrimer::EmailUpdatesSwitchComponent.new(+ def email_updates_mode_selector+ OpPrimer::EmailUpdatesModeSelectorComponent.new(toggle: @meeting.notify?,path: toggle_notifications_dialog_project_meeting_path(@meeting.project, @meeting),title: I18n.t("meeting.notifications.sidepanel.title"),diff --git a/modules/meeting/spec/features/meeting_notifications_spec.rb b/modules/meeting/spec/features/meeting_notifications_spec.rbindex bf1485b44b8..50066ffa499 100644--- a/modules/meeting/spec/features/meeting_notifications_spec.rb+++ b/modules/meeting/spec/features/meeting_notifications_spec.rb@@ -99,7 +99,7 @@ RSpec.describe "Meeting notifications", :js doshow_page.visit!# check calendar updates sidepanel component- page.within("[data-test-selector='email-updates-switch']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doexpect(page).to have_text("Email calendar updates")expect(page).to have_text("Enabled.")expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")@@ -125,7 +125,7 @@ RSpec.describe "Meeting notifications", :js doActionMailer::Base.deliveries.clear# disable updates from the sidepanel- page.within("[data-test-selector='email-updates-switch']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doclick_on "Disable"end@@ -139,7 +139,7 @@ RSpec.describe "Meeting notifications", :js do# check that updates are now disabledexpect(meeting.reload.notify).to be false- page.within("[data-test-selector='email-updates-switch']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doexpect(page).to have_text("Email calendar updates")expect(page).to have_text("Disabled.")expect(page).to have_text("Participants will not receive an email informing them of changes.")@@ -160,7 +160,7 @@ RSpec.describe "Meeting notifications", :js dowait_for_network_idle# enable updates and check that an email is sent out immediately- page.within("[data-test-selector='notifications-button']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doclick_on "Enable"end@@ -178,7 +178,7 @@ RSpec.describe "Meeting notifications", :js doActionMailer::Base.deliveries.clear# check that no mails are sent on edit/delete when disabled- page.within("[data-test-selector='notifications-button']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doclick_on "Disable"end@@ -259,7 +259,7 @@ RSpec.describe "Meeting notifications", :js dotemplate_page.visit!# check sidepanel component- page.within("[data-test-selector='email-updates-switch']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doexpect(page).to have_text("Email calendar updates")expect(page).to have_text("Enabled.")expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")@@ -289,7 +289,7 @@ RSpec.describe "Meeting notifications", :js do# switch to occurrence and check sidepanel componentoccurrence_page.visit!- page.within("[data-test-selector='email-updates-switch']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doexpect(page).to have_text("Email calendar updates")expect(page).to have_text("Enabled.")expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")@@ -320,7 +320,7 @@ RSpec.describe "Meeting notifications", :js do# turn off updates from the templatetemplate_page.visit!- page.within("[data-test-selector='email-updates-switch']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doclick_on "Disable"end@@ -336,7 +336,7 @@ RSpec.describe "Meeting notifications", :js do# check that this is reflected for occurrences toooccurrence_page.visit!- page.within("[data-test-selector='email-updates-switch']") do+ page.within("[data-test-selector='email-updates-mode-selector']") doexpect(page).to have_text("Email calendar updates")expect(page).to have_text("Disabled.")expect(page).to have_text("Participants will not receive an email informing them of changes.")@@ -371,7 +371,7 @@ RSpec.describe "Meeting notifications", :js doit "does not show the sidebar component" doshow_page.visit!- expect(page).to have_no_css("[data-test-selector='email-updates-switch']")+ expect(page).to have_no_css("[data-test-selector='email-updates-mode-selector']")endend@@ -392,7 +392,7 @@ RSpec.describe "Meeting notifications", :js doit "does not show the sidebar component" doshow_page.visit!- expect(page).to have_no_css("[data-test-selector='email-updates-switch']")+ expect(page).to have_no_css("[data-test-selector='email-updates-mode-selector']")endendenddiff --git a/modules/storages/app/components/storages/admin/side_panel/email_updates_switch_component.rb b/modules/storages/app/components/storages/admin/side_panel/email_updates_mode_selector_component.rbsimilarity index 93%rename from modules/storages/app/components/storages/admin/side_panel/email_updates_switch_component.rbrename to modules/storages/app/components/storages/admin/side_panel/email_updates_mode_selector_component.rbindex eea134863d6..8056b51259b 100644--- a/modules/storages/app/components/storages/admin/side_panel/email_updates_switch_component.rb+++ b/modules/storages/app/components/storages/admin/side_panel/email_updates_mode_selector_component.rb@@ -30,7 +30,7 @@module Storagesmodule Admin- class SidePanel::EmailUpdatesSwitchComponent < ApplicationComponent+ class SidePanel::EmailUpdatesModeSelectorComponent < ApplicationComponentinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpers@@ -46,7 +46,7 @@ module Storagesdef callcomponent_wrapper do- render OpPrimer::EmailUpdatesSwitchComponent.new(+ render OpPrimer::EmailUpdatesModeSelectorComponent.new(toggle: @storage.health_notifications_should_be_sent?,path: change_health_notifications_enabled_admin_settings_storage_path(@storage),title: I18n.t("storages.health_email_notifications.title"),diff --git a/modules/storages/app/components/storages/admin/side_panel_component.html.erb b/modules/storages/app/components/storages/admin/side_panel_component.html.erbindex 7b9bdeb16ca..f537f4089ef 100644--- a/modules/storages/app/components/storages/admin/side_panel_component.html.erb+++ b/modules/storages/app/components/storages/admin/side_panel_component.html.erb@@ -6,7 +6,7 @@if @storage.automatic_management_enabled?panel.with_section(Storages::Admin::SidePanel::HealthNotificationsComponent.new(storage: @storage))- panel.with_section(Storages::Admin::SidePanel::EmailUpdatesSwitchComponent.new(storage: @storage))+ panel.with_section(Storages::Admin::SidePanel::EmailUpdatesModeSelectorComponent.new(storage: @storage))endendenddiff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex 5643454f0f1..45c8795dcca 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -160,7 +160,7 @@ class Storages::Admin::StoragesController < ApplicationControllerdef change_health_notifications_enabledif @storage.update(health_notifications_enabled: [email protected]_notifications_enabled)- update_via_turbo_stream(component: Storages::Admin::SidePanel::EmailUpdatesSwitchComponent.new(storage: @storage))+ update_via_turbo_stream(component: Storages::Admin::SidePanel::EmailUpdatesModeSelectorComponent.new(storage: @storage))respond_with_turbo_streamselseflash.now[:error] = I18n.t("storages.health_email_notifications.error_could_not_be_saved")diff --git a/modules/storages/spec/components/storages/admin/side_panel/email_updates_switch_component_spec.rb b/modules/storages/spec/components/storages/admin/side_panel/email_updates_mode_selector_component_spec.rbsimilarity index 90%rename from modules/storages/spec/components/storages/admin/side_panel/email_updates_switch_component_spec.rbrename to modules/storages/spec/components/storages/admin/side_panel/email_updates_mode_selector_component_spec.rbindex 75a89f2b8a3..0fff6844353 100644--- a/modules/storages/spec/components/storages/admin/side_panel/email_updates_switch_component_spec.rb+++ b/modules/storages/spec/components/storages/admin/side_panel/email_updates_mode_selector_component_spec.rb@@ -31,7 +31,7 @@require "spec_helper"require_module_spec_helper-RSpec.describe Storages::Admin::SidePanel::EmailUpdatesSwitchComponent, type: :component do+RSpec.describe Storages::Admin::SidePanel::EmailUpdatesModeSelectorComponent, type: :component dodescribe "storage without automatically managed project folders" dolet(:storage) { build_stubbed(:nextcloud_storage, :as_not_automatically_managed) }@@ -52,7 +52,7 @@ RSpec.describe Storages::Admin::SidePanel::EmailUpdatesSwitchComponent, type: :cit "renders a 'Disable' option with info" dotext = "Admins will receive updates by email when there are important updates."- expect(page).to have_test_selector("email-updates-switch", text: text)+ expect(page).to have_test_selector("email-updates-mode-selector", text: text)expect(page).to have_selector(:link_or_button, "Disable")endend@@ -62,7 +62,7 @@ RSpec.describe Storages::Admin::SidePanel::EmailUpdatesSwitchComponent, type: :cit "renders an 'Enable' option with info" dotext = "Admins will not receive updates by email when there are important updates."- expect(page).to have_test_selector("email-updates-switch", text:)+ expect(page).to have_test_selector("email-updates-mode-selector", text:)expect(page).to have_selector(:link_or_button, "Enable")endenddiff --git a/modules/storages/spec/features/storages/admin/edit_storage_spec.rb b/modules/storages/spec/features/storages/admin/edit_storage_spec.rbindex e297b033638..c660ee1f930 100644--- a/modules/storages/spec/features/storages/admin/edit_storage_spec.rb+++ b/modules/storages/spec/features/storages/admin/edit_storage_spec.rb@@ -229,14 +229,14 @@ RSpec.describe "Admin Edit File storage",aggregate_failures "Health notifications" doexpect(page).to have_test_selector("storage-health-status", text: "Pending")- expect(page).to have_test_selector("email-updates-switch-button", text: "Disable")- expect(page).to have_test_selector("email-updates-switch",+ expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Disable")+ expect(page).to have_test_selector("email-updates-mode-selector",text: "Admins will receive updates by email when there are important updates.")click_on "Disable"- expect(page).to have_test_selector("email-updates-switch-button", text: "Enable")- expect(page).to have_test_selector("email-updates-switch",+ expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Enable")+ expect(page).to have_test_selector("email-updates-mode-selector",text: "Admins will not receive updates by email when there are important updates.")endend@@ -358,14 +358,14 @@ RSpec.describe "Admin Edit File storage",aggregate_failures "Health notifications" doexpect(page).to have_test_selector("storage-health-status", text: "Pending")- expect(page).to have_test_selector("email-updates-switch-button", text: "Disable")- expect(page).to have_test_selector("email-updates-switch",+ expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Disable")+ expect(page).to have_test_selector("email-updates-mode-selector",text: "Admins will receive updates by email when there are important updates.")click_on "Disable"- expect(page).to have_test_selector("email-updates-switch-button", text: "Enable")- expect(page).to have_test_selector("email-updates-switch",+ expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Enable")+ expect(page).to have_test_selector("email-updates-mode-selector",text: "Admins will not receive updates by email when there are important updates.")endend@@ -492,14 +492,14 @@ RSpec.describe "Admin Edit File storage",aggregate_failures "Health notifications" doexpect(page).to have_test_selector("storage-health-status", text: "Pending")- expect(page).to have_test_selector("email-updates-switch-button", text: "Disable")- expect(page).to have_test_selector("email-updates-switch",+ expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Disable")+ expect(page).to have_test_selector("email-updates-mode-selector",text: "Admins will receive updates by email when there are important updates.")click_on "Disable"- expect(page).to have_test_selector("email-updates-switch-button", text: "Enable")- expect(page).to have_test_selector("email-updates-switch",+ expect(page).to have_test_selector("email-updates-mode-selector-button", text: "Enable")+ expect(page).to have_test_selector("email-updates-mode-selector",text: "Admins will not receive updates by email when there are important updates.")endend