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
Fix copying meetings between types, allow empty copy of structured meetings
Oliver Güntherfce2fb2d6827
diff --git a/modules/meeting/app/components/meetings/header_component.html.erb b/modules/meeting/app/components/meetings/header_component.html.erbindex a85d5b23f7d..7b1374d8592 100644--- a/modules/meeting/app/components/meetings/header_component.html.erb+++ b/modules/meeting/app/components/meetings/header_component.html.erb@@ -21,12 +21,21 @@item.with_leading_visual_icon(icon: :pencil)end if @meeting.editable?+ menu.with_item(label: t(:button_copy),+ href: copy_meeting_path(@meeting),+ content_arguments: {+ data: { turbo: false }+ }) do |item|+ item.with_leading_visual_icon(icon: :copy)+ end+menu.with_item(label: t(:label_icalendar_download),href: download_ics_meeting_path(@meeting)) do |item|item.with_leading_visual_icon(icon: :download)end- if User.current.allowed_to?(:send_meeting_agendas_notification, @meeting.project)+ if User.current.allowed_in_project?(:send_meeting_agendas_notification, @meeting.project+ )menu.with_item(label: t('meeting.label_mail_all_participants'),href: notify_meeting_path(@meeting),form_arguments: { method: :post, data: { turbo: 'false' } }) do |item|diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 41ef478cd64..386c36167fb 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -102,7 +102,7 @@ class MeetingsController < ApplicationControllerparams[:copied_from_meeting_id] = @meeting.idparams[:copied_meeting_agenda_text] = @meeting.agenda.text if @meeting.agenda.present?@meeting = @meeting.copy(author: User.current)- render action: 'new', project_id: @project+ render action: 'new', project_id: @project, locals: { copy: true }enddef destroydiff --git a/modules/meeting/app/views/meetings/_form.html.erb b/modules/meeting/app/views/meetings/_form.html.erbindex 26cac65acb0..87d9e388f3f 100644--- a/modules/meeting/app/views/meetings/_form.html.erb+++ b/modules/meeting/app/views/meetings/_form.html.erb@@ -55,6 +55,10 @@ See COPYRIGHT and LICENSE files for more details.</span><p class="op-tile-block--description"><%= t('meeting.types.structured_text') %>+ <% if local_assigns[:copy] %>+ <br/>+ <strong><%= t('meeting.types.structured_text_copy') %></strong>+ <% end %></p></div></div>diff --git a/modules/meeting/app/views/meetings/new.html.erb b/modules/meeting/app/views/meetings/new.html.erbindex a11f9539fed..79706a160fb 100644--- a/modules/meeting/app/views/meetings/new.html.erb+++ b/modules/meeting/app/views/meetings/new.html.erb@@ -30,12 +30,13 @@ See COPYRIGHT and LICENSE files for more details.<% html_title t(:label_meeting_new) %><%= toolbar title: t(:label_meeting_new) %><%= labelled_tabular_form_for @meeting,+ as: :meeting,url: {:controller => '/meetings', :action => 'create', :project_id => @project},:html => {:id => 'meeting-form',:data => { :controller => 'refresh-on-form-changes','refresh-on-form-changes-target': 'form','refresh-on-form-changes-turbo-stream-url-value': new_meeting_url }} do |f| -%>- <%= render :partial => 'form', :locals => {:f => f} %>+ <%= render :partial => 'form', :locals => { f:, copy: local_assigns[:copy] } %><%= styled_button_tag t(:button_create), class: '-highlight' %><%= link_to t(:button_cancel), { :action => 'index', :project_id => @project },class: 'button' %>diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex 331132c93ad..ab3485306e0 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -125,6 +125,7 @@ en:classic_text: 'Organize your meeting in a formattable text agenda and protocol.'structured: 'Dynamic'structured_text: 'Organize your meeting as a list of agenda items, optionally linking them to a work package.'+ structured_text_copy: 'Copying a meeting will currently not copy the associated meeting agenda items, just the details'copied: "Copied from Meeting #%{id}"notice_successful_notification: "Notification sent successfully"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.rbindex 6e60f575116..81b01efdf6d 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@@ -62,7 +62,8 @@ RSpec.describe 'Structured meetings CRUD',let(:current_user) { user }let(:new_page) { Pages::Meetings::New.new(project) }- let(:show_page) { Pages::StructuredMeeting::Show.new(StructuredMeeting.order(id: :asc).last) }+ let(:meeting) { StructuredMeeting.order(id: :asc).last }+ let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) }before dologin_as current_user@@ -250,6 +251,30 @@ RSpec.describe 'Structured meetings CRUD',expect(page).to have_css('.flash', text: I18n.t('activerecord.errors.messages.error_conflict'))end+ it 'can copy the meeting (empty)' do+ show_page.expect_toast(message: 'Successful creation')++ # Can add and edit a single item+ show_page.add_agenda_item do+ fill_in 'Title', with: 'My agenda item'+ fill_in 'Duration (min)', with: '25'+ end++ show_page.expect_agenda_item title: 'My agenda item'+ show_page.cancel_add_form++ click_button('op-meetings-header-action-trigger')+ click_link 'Copy'++ expect(page).to have_current_path "/meetings/#{meeting.id}/copy"++ click_button 'Create'++ expect(page).to have_text 'Your meeting is empty'+ new_meeting = StructuredMeeting.order(id: :asc).last+ expect(page).to have_current_path "/meetings/#{new_meeting.id}"+ end+context 'with a work package reference to another' dolet!(:meeting) { create(:structured_meeting, project:, author: current_user) }let!(:other_project) { create(:project) }