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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
When participants are empty, fall back to copy author
Oliver Günther9efb1ccc70a5
diff --git a/modules/meeting/app/services/meetings/copy_service.rb b/modules/meeting/app/services/meetings/copy_service.rbindex c20714f8de9..2cd06e2366b 100644--- a/modules/meeting/app/services/meetings/copy_service.rb+++ b/modules/meeting/app/services/meetings/copy_service.rb@@ -77,10 +77,18 @@ module Meetings.merge("start_time" => meeting.start_time + 1.week).merge("author" => user).merge("state" => "open")- .merge("participants_attributes" => meeting.allowed_participants.collect(&:copy_attributes))+ .merge("participants_attributes" => copied_participants).merge(overwritten_attributes)end+ def copied_participants+ if meeting.allowed_participants.empty?+ [{ "user_id" => user.id, "invited" => true }]+ else+ meeting.allowed_participants.collect(&:copy_attributes)+ end+ end+def writable_meeting_attributes(meeting)instantiate_contract(meeting, user).writable_attributes - %w[start_date start_time_hour]enddiff --git a/modules/meeting/spec/services/meetings/copy_service_integration_spec.rb b/modules/meeting/spec/services/meetings/copy_service_integration_spec.rbindex c103397bc3e..c647bffc468 100644--- a/modules/meeting/spec/services/meetings/copy_service_integration_spec.rb+++ b/modules/meeting/spec/services/meetings/copy_service_integration_spec.rb@@ -81,6 +81,17 @@ RSpec.describe Meetings::CopyService, "integration", type: :model doendend+ describe "without participants" do+ it "sets the author as invited" do+ meeting.participants.destroy_all++ expect(service_result).to be_success+ expect(copy.participants.count).to eq(1)+ invited = copy.participants.find_by(user:)+ expect(invited).to be_invited+ end+ end+describe "when not saving" dolet(:params) { { save: false } }