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

Don't show day of week when not weekly

Oliver Günther11fdf3427773
diff --git a/modules/meeting/app/components/meetings/side_panel/details_component.html.erb b/modules/meeting/app/components/meetings/side_panel/details_component.html.erb
index a0cc27b3170..5ea1394963a 100644
--- a/modules/meeting/app/components/meetings/side_panel/details_component.html.erb
+++ b/modules/meeting/app/components/meetings/side_panel/details_component.html.erb
@@ -39,7 +39,7 @@
@meeting.recurring_meeting.human_day_of_week
end
end
- end if @meeting.recurring_meeting.frequency != "daily"
+ end if @meeting.recurring_meeting.frequency_weekly?
else
if @series.present?
details.with_row(mb: 2) do
diff --git a/modules/meeting/spec/components/meetings/side_panel/details_component_spec.rb b/modules/meeting/spec/components/meetings/side_panel/details_component_spec.rb
new file mode 100644
index 00000000000..709db948fd1
--- /dev/null
+++ b/modules/meeting/spec/components/meetings/side_panel/details_component_spec.rb
@@ -0,0 +1,76 @@
+# frozen_string_literal: true
+
+#-- 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.
+#++
+
+require "rails_helper"
+
+RSpec.describe Meetings::SidePanel::DetailsComponent, type: :component do
+ let(:user) { build_stubbed(:user) }
+
+ subject do
+ render_inline(described_class.new(meeting:))
+ page
+ end
+
+ before do
+ login_as(user)
+ end
+
+ context "with templated meeting and working_days frequency" do
+ let(:series) do
+ build_stubbed(:recurring_meeting,
+ start_time: DateTime.parse("2024-12-04T10:00:00Z"),
+ frequency: "working_days")
+ end
+ let(:meeting) do
+ build_stubbed(:structured_meeting_template,
+ recurring_meeting: series)
+ end
+
+ it "doesn't show the weekday" do
+ expect(subject).to have_no_text("Wednesday")
+ end
+ end
+
+ context "with templated meeting and weekly frequency" do
+ let(:series) do
+ build_stubbed(:recurring_meeting,
+ start_time: DateTime.parse("2024-12-04T10:00:00Z"),
+ frequency: "weekly")
+ end
+ let(:meeting) do
+ build_stubbed(:structured_meeting_template,
+ recurring_meeting: series)
+ end
+
+ it "shows the weekday" do
+ expect(subject).to have_text("Wednesday")
+ end
+ end
+end
diff --git a/modules/meeting/spec/factories/meeting_factory.rb b/modules/meeting/spec/factories/meeting_factory.rb
index 68dd2c14897..3ec2041df7d 100644
--- a/modules/meeting/spec/factories/meeting_factory.rb
+++ b/modules/meeting/spec/factories/meeting_factory.rb
@@ -49,8 +49,9 @@ FactoryBot.define do
recurring_meeting
after(:build) do |template, evaluator|
- template.author = evaluator.recurring_meeting.author
- template.project = evaluator.recurring_meeting.project
+ %w[author project start_time].each do |attr|
+ template.send(:"#{attr}=", evaluator.recurring_meeting.send(attr))
+ end
end
end
end
diff --git a/modules/meeting/spec/factories/recurring_meeting_factory.rb b/modules/meeting/spec/factories/recurring_meeting_factory.rb
index fc1188dd843..204860667b8 100644
--- a/modules/meeting/spec/factories/recurring_meeting_factory.rb
+++ b/modules/meeting/spec/factories/recurring_meeting_factory.rb
@@ -46,11 +46,5 @@ FactoryBot.define do
recurring_meeting.project = project
recurring_meeting.template = create(:structured_meeting_template, recurring_meeting:, project:)
end
-
- after(:stub) do |recurring_meeting, evaluator|
- project = evaluator.project
- recurring_meeting.project = project
- recurring_meeting.template = build_stubbed(:structured_meeting_template, recurring_meeting:, project:)
- end
end
end