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

Fix send_notifications being ignored when copying meetings

Oliver Günther9117774d9c71
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index 41588cf11dd..f0b2fa129ea 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -398,7 +398,8 @@ class MeetingsController < ApplicationController
def copy_attributes
{
copy_agenda: params[:copy_agenda] == "1",
- copy_attachments: params[:copy_attachments] == "1"
+ copy_attachments: params[:copy_attachments] == "1",
+ send_notifications: params[:send_notifications] == "1"
}
end
end
diff --git a/modules/meeting/spec/requests/meetings_spec.rb b/modules/meeting/spec/requests/meetings_spec.rb
index 075e7bc5ebf..4433baed6e2 100644
--- a/modules/meeting/spec/requests/meetings_spec.rb
+++ b/modules/meeting/spec/requests/meetings_spec.rb
@@ -74,6 +74,33 @@ RSpec.describe "Meeting requests",
end
end
+ describe "send_notifications" do
+ let(:params) { { send_notifications: } }
+
+ context "when enabled" do
+ let(:send_notifications) { "1" }
+
+ before do
+ meeting.participants.create!(user:, invited: true)
+
+ subject
+ perform_enqueued_jobs
+ end
+
+ it "sends out emails" do
+ expect(ActionMailer::Base.deliveries.size).to eq 1
+ end
+ end
+
+ context "when disabled" do
+ let(:send_notifications) { "0" }
+
+ it "sends out no emails" do
+ expect(ActionMailer::Base.deliveries).to be_empty
+ end
+ end
+ end
+
context "when copying without additional params" do
it "copies the meeting, but not the agenda" do
subject