Skip to content

Commit f41a923

Browse files
Handle empty meetings
1 parent eff0dca commit f41a923

File tree

6 files changed

+43
-4
lines changed

6 files changed

+43
-4
lines changed

modules/meeting/app/components/meetings/header_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
end
5050
end
5151

52-
if OpenProject::FeatureDecisions.meetings_presentation_mode_active?
52+
if OpenProject::FeatureDecisions.meetings_presentation_mode_active? && @meeting.agenda_items.any?
5353
header.with_action_button(
5454
tag: :a,
5555
scheme: :secondary,

modules/meeting/app/components/meetings/presentation_component.html.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
<% end %>
4949
<% end %>
5050

51-
<!-- Footer with controls -->
5251
<div class="op-meeting-presentation--footer">
5352
<div class="op-meeting-presentation--footer-left">
5453
<%= render(Primer::Beta::Button.new(

modules/meeting/app/components/meetings/presentation_component.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def check_for_updates_interval
5050
5_000
5151
end
5252

53+
def render?
54+
@agenda_item_ids.any?
55+
end
56+
5357
def current_item
5458
return nil if @current_item.nil?
5559

modules/meeting/app/controllers/meeting_presentation_controller.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class MeetingPresentationController < ApplicationController
3535
before_action :check_feature_flag
3636

3737
before_action :find_meeting
38+
before_action :check_presentable
3839
before_action :find_agenda_item, only: [:check_for_updates]
3940

4041
load_and_authorize_with_permission_in_optional_project :view_meetings
@@ -79,6 +80,14 @@ def check_feature_flag
7980
end
8081
end
8182

83+
def check_presentable
84+
if @meeting.agenda_items.empty?
85+
flash[:warning] = t("meeting.presentation_mode.no_items_flash")
86+
redirect_to project_meeting_path(@meeting.project, @meeting),
87+
status: :see_other
88+
end
89+
end
90+
8291
def determine_current_id
8392
return sorted_agenda_item_ids.first if params[:current_id].blank?
8493

modules/meeting/config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ en:
382382
previous: "Previous"
383383
next: "Next"
384384
no_items: "No agenda items"
385+
no_items_flash: "There are no agenda items to present."
385386

386387
meeting_section:
387388
untitled_title: "Untitled section"

modules/meeting/spec/features/presentation/meeting_presentation_mode_spec.rb

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) }
3939
shared_let(:user) do
4040
create :user,
41-
lastname: "Presenter",
4241
preferences: { time_zone: "Etc/UTC" },
4342
member_with_permissions: { project => %i[view_meetings manage_agendas manage_outcomes] }
4443
end
@@ -74,7 +73,10 @@ def outcome_field_for(agenda_item)
7473
expect(page).to have_text("First Item")
7574
expect(page).to have_text("Second Item")
7675

77-
click_link_or_button "Present"
76+
within("#meetings-header-component") do
77+
expect(page).to have_link("Present")
78+
click_link_or_button "Present"
79+
end
7880

7981
# Verify we're in presentation mode
8082
expect(page).to have_current_path(project_meeting_presentation_path(project, meeting), ignore_query: true)
@@ -151,4 +153,28 @@ def outcome_field_for(agenda_item)
151153
# Verify we're back on the show page
152154
expect(page).to have_current_path(project_meeting_path(project, meeting), ignore_query: true)
153155
end
156+
157+
context "with an empty meeting" do
158+
let(:meeting) do
159+
create :meeting,
160+
project:,
161+
title: "Empty meeting",
162+
start_time: "2025-10-31T10:00:00Z",
163+
state: :in_progress,
164+
author: user
165+
end
166+
167+
it "does not show the present button" do
168+
show_page.visit!
169+
170+
within("#meetings-header-component") do
171+
expect(page).to have_no_link("Present")
172+
end
173+
174+
# When visiting the presentation mode directly
175+
visit project_meeting_presentation_path(project, meeting)
176+
177+
expect_flash(type: :warning, message: "There are no agenda items to present.")
178+
end
179+
end
154180
end

0 commit comments

Comments
 (0)