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

Default new meeting time to next week

Oliver Günther355ba32ae6db
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index 2f76537a651..865b331b7d6 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -165,13 +165,15 @@ class Meeting < ApplicationRecord
def copy(attrs)
copy = dup
- # Called simply to initialize the value
- copy.start_date
- copy.start_time_hour
+ # Set a default to next week
+ copy.start_time = start_time + 1.week
copy.author = attrs.delete(:author)
copy.attributes = attrs
copy.set_initial_values
+ # Initialize virtual attributes
+ copy.start_date
+ copy.start_time_hour
copy.participants.clear
copy.participants_attributes = allowed_participants.collect(&:copy_attributes)
diff --git a/modules/meeting/spec/features/meetings_copy_spec.rb b/modules/meeting/spec/features/meetings_copy_spec.rb
index 0bd102932c9..b8722e1bdd7 100644
--- a/modules/meeting/spec/features/meetings_copy_spec.rb
+++ b/modules/meeting/spec/features/meetings_copy_spec.rb
@@ -62,7 +62,7 @@ RSpec.describe 'Meetings copy', :js, :with_cuprite do
shared_let(:twelve_hour_format) { "%I:%M %p" }
shared_let(:copied_meeting_time_heading) do
- date = start_time.strftime("%m/%d/%Y")
+ date = start_time.next_week.strftime("%m/%d/%Y")
start_of_meeting = start_time.strftime(twelve_hour_format)
end_of_meeting = (start_time + meeting.duration.hours).strftime(twelve_hour_format)
@@ -90,7 +90,7 @@ RSpec.describe 'Meetings copy', :js, :with_cuprite do
expect(page)
.to have_field 'Duration', with: meeting.duration
expect(page)
- .to have_field 'Start date', with: start_time.strftime("%Y-%m-%d")
+ .to have_field 'Start date', with: start_time.next_week.strftime("%Y-%m-%d")
expect(page)
.to have_field 'Time', with: start_time.strftime("%H:%M")
diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
index 81b01efdf6d..ee5735b5e51 100644
--- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
@@ -271,7 +271,7 @@ RSpec.describe 'Structured meetings CRUD',
click_button 'Create'
expect(page).to have_text 'Your meeting is empty'
- new_meeting = StructuredMeeting.order(id: :asc).last
+ new_meeting = StructuredMeeting.reorder(id: :asc).last
expect(page).to have_current_path "/meetings/#{new_meeting.id}"
end