diff --git a/modules/meeting/app/components/recurring_meetings/row_component.rb b/modules/meeting/app/components/recurring_meetings/row_component.rb index 44121384e465..16c7dc0104b5 100644 --- a/modules/meeting/app/components/recurring_meetings/row_component.rb +++ b/modules/meeting/app/components/recurring_meetings/row_component.rb @@ -118,6 +118,7 @@ def status_scheme(state) end def create + return unless copy_allowed? return if instantiated? || cancelled? render( diff --git a/modules/meeting/app/components/recurring_meetings/show_page_header_component.html.erb b/modules/meeting/app/components/recurring_meetings/show_page_header_component.html.erb index d4b156c36d0d..93121f0e7d07 100644 --- a/modules/meeting/app/components/recurring_meetings/show_page_header_component.html.erb +++ b/modules/meeting/app/components/recurring_meetings/show_page_header_component.html.erb @@ -17,7 +17,7 @@ classes: "hide-when-print", "aria-label": "Menu", data: { - "test-selector": "action-menu" + "test-selector": "recurring-meeting-action-menu" } }) do |menu, _button| menu.with_item( diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb index 8b5c4e8bcdb3..a74b32d54bca 100644 --- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb +++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb @@ -80,7 +80,7 @@ it "can delete a recurring meeting from the show page and return to the index page" do show_page.visit! - click_on "action-menu" + click_on "recurring-meeting-action-menu" accept_confirm(I18n.t("text_are_you_sure")) do click_on "Delete meeting series" @@ -162,4 +162,30 @@ show_page.expect_rescheduled_meeting old_date: "12/31/2024 01:30 PM", new_date: "01/01/2025 01:30 PM" end + + context "with view permissions only" do + let(:current_user) { other_user } + + it "does not allow to act on the recurring meeting" do + show_page.visit! + + expect(page).to have_no_content "Create from template" + show_page.expect_open_meeting date: "12/31/2024 01:30 PM" + + within("li", text: "12/31/2024 01:30 PM") do + click_on "more-button" + + expect(page).to have_css(".ActionListItem-label", count: 1) + expect(page).to have_css(".ActionListItem-label", text: "Download iCalendar event") + + # Close it again + click_on "more-button" + end + + show_page.expect_scheduled_meeting date: "01/07/2025 01:30 PM" + show_page.expect_scheduled_meeting date: "01/14/2025 01:30 PM" + + expect(page).not_to have_test_selector "recurring-meeting-action-menu" + end + end end diff --git a/modules/meeting/spec/support/pages/recurring_meeting/show.rb b/modules/meeting/spec/support/pages/recurring_meeting/show.rb index 90611881d1a5..0c9fe779ac3c 100644 --- a/modules/meeting/spec/support/pages/recurring_meeting/show.rb +++ b/modules/meeting/spec/support/pages/recurring_meeting/show.rb @@ -101,7 +101,7 @@ def expect_subtitle(text:) end def edit_meeting_series - page.find_test_selector("action-menu").click + page.find_test_selector("recurring-meeting-action-menu").click click_on "Edit meeting series" expect(page).to have_css("#new-meeting-dialog") @@ -111,6 +111,12 @@ def in_edit_dialog(&) page.within("#new-meeting-dialog", &) end + def expect_no_actions(date:) + within("li", text: date) do + expect(page).not_to have_test_selector("more-button") + end + end + def expect_open_actions(date:) within("li", text: date) do click_on "more-button"