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

initialize virtual meeting attributes on copy

ulfertsce0a7878521d
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index a8bc8702e49..eb8882387d8 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -39,9 +39,7 @@ class MeetingsController < ApplicationController
tomorrows_meetings_count = scope.from_tomorrow.count
@page_of_today = 1 + tomorrows_meetings_count / per_page_param
- page = params['page'] ?
- page_param :
- @page_of_today
+ page = params['page'] ? page_param : @page_of_today
@meetings = scope.with_users_by_date
.page(page)
@@ -78,8 +76,7 @@ class MeetingsController < ApplicationController
end
end
- def new
- end
+ def new; end
current_menu_item :new do
:meetings
@@ -98,8 +95,7 @@ class MeetingsController < ApplicationController
redirect_to action: 'index', project_id: @project
end
- def edit
- end
+ def edit; end
def update
@meeting.participants_attributes = @converted_params.delete(:participants_attributes)
@@ -155,7 +151,8 @@ class MeetingsController < ApplicationController
@converted_params[:participants_attributes].each { |p| p.reverse_merge! attended: false, invited: false }
end
-private
+ private
+
def meeting_params
params.require(:meeting).permit(:title, :location, :start_time, :duration, :start_date, :start_time_hour,
participants_attributes: [:email, :name, :invited, :attended, :user, :user_id, :meeting, :id])
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index ff8718ed603..92adeea3361 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -47,7 +47,7 @@ class Meeting < ActiveRecord::Base
date_column: "#{table_name}.created_at"
acts_as_journalized
- acts_as_event title: Proc.new {|o|
+ acts_as_event title: Proc.new { |o|
"#{l :label_meeting}: #{o.title} \
#{format_date o.start_time} \
#{format_time o.start_time, false}-#{format_time o.end_time, false})"
@@ -138,9 +138,13 @@ class Meeting < ActiveRecord::Base
def copy(attrs)
copy = dup
+ # Called simply to initialize the value
+ copy.start_date
+ copy.start_time_hour
+
copy.author = attrs.delete(:author)
copy.attributes = attrs
- copy.send(:set_initial_values)
+ copy.set_initial_values
copy.participants.clear
copy.participants_attributes = participants.collect(&:copy_attributes)
diff --git a/modules/meeting/features/meetings_copy.feature b/modules/meeting/features/meetings_copy.feature
index 6ffd1c1f893..37272f02447 100644
--- a/modules/meeting/features/meetings_copy.feature
+++ b/modules/meeting/features/meetings_copy.feature
@@ -47,15 +47,6 @@ Feature: Copy meetings
| duration | 1.5 |
| start_time | 2013-03-27 18:55:00 |
- Scenario: Navigate to a meeting page with permission to create meetings
- Given the role "user" may have the following rights:
- | view_meetings |
- | create_meetings |
- When I am already logged in as "alice"
- And I go to the Meetings page for the project called "dingens"
- And I click on "Alices Meeting"
- Then I should see "Copy" within ".meeting--main-toolbar"
-
Scenario: Navigate to a meeting copy page
Given the role "user" may have the following rights:
| view_meetings |
@@ -63,7 +54,8 @@ Feature: Copy meetings
When I am already logged in as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Alices Meeting"
- And I click on "Copy"
+ Then I should see "Copy" within ".meeting--main-toolbar"
+ When I click on "Copy"
Then the "meeting[title]" field should contain "Alices Meeting"
And the "meeting[location]" field should contain "CZI"
And the "meeting[duration]" field should contain "1.5"