Skip to content

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

Update header_component to conditionally send data

Mir Bhatia9efa181c7cca
diff --git a/modules/meeting/app/components/meetings/header_component.html.erb b/modules/meeting/app/components/meetings/header_component.html.erb
index 4f4d617e7a5..17a8dddd414 100644
--- a/modules/meeting/app/components/meetings/header_component.html.erb
+++ b/modules/meeting/app/components/meetings/header_component.html.erb
@@ -1,14 +1,18 @@
<%=
+ params = {
+ controller: "poll-for-changes",
+ poll_for_changes_reference_value: @meeting.changed_hash,
+ poll_for_changes_url_value: check_for_updates_meeting_path(@meeting),
+ poll_for_changes_interval_value: check_for_updates_interval
+ }
+
component_wrapper do
render(Primer::OpenProject::PageHeader.new(
test_selector: "meeting-page-header",
state: @state,
- data: {
- controller: "poll-for-changes",
- poll_for_changes_reference_value: @meeting.changed_hash,
- poll_for_changes_url_value: check_for_updates_meeting_path(@meeting),
- poll_for_changes_interval_value: check_for_updates_interval,
- }
+ data: {}.merge(
+ OpenProject::FeatureDecisions.meeting_updated_notification_active? ? params : {}
+ )
)) do |header|
header.with_title do |title|
title.with_editable_form(model: @meeting,
diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb
index 2d739c450e2..31e225772f8 100644
--- a/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe "Structured meetings CRUD",
let(:meeting) { create(:structured_meeting, project:, author: current_user) }
let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) }
- describe "meeting update flash" do
+ describe "meeting update flash", with_flag: { meeting_updated_notification: true } do
before do
# Disable the polling so we can trigger it manually
allow_any_instance_of(Meetings::HeaderComponent) # rubocop:disable RSpec/AnyInstance