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

Update notification sending behaviour on copy

Mir Bhatiaaca8a5d23245
diff --git a/modules/meeting/app/components/meetings/index/form_component.html.erb b/modules/meeting/app/components/meetings/index/form_component.html.erb
index a08ea8fdcb4..e69fe474ef0 100644
--- a/modules/meeting/app/components/meetings/index/form_component.html.erb
+++ b/modules/meeting/app/components/meetings/index/form_component.html.erb
@@ -123,9 +123,27 @@
end
end
+ if @copy_from
+ modal_body.with_row do
+ render(Meeting::CopiedFrom.new(f, id: @copy_from.id))
+ end
+
+ modal_body.with_row(mt: 3) do
+ render(Meeting::CopyItems.new(f))
+ end
+
+ modal_body.with_row(mt: 3) do
+ render(Meeting::CopyParticipants.new(f))
+ end
+
+ modal_body.with_row(mt: 3) do
+ render(Meeting::CopyAttachments.new(f))
+ end
+ end
+
if (@meeting.is_a?(RecurringMeeting) && [email protected]?) || @meeting.is_a?(Meeting)
modal_body.with_row(mt: 3) do
- render(Meeting::SendEmailUpdates.new(f, meeting: @meeting))
+ render(Meeting::SendEmailUpdates.new(f, meeting: @meeting, copy_from: @copy_from))
end
modal_body.with_row(
@@ -153,28 +171,6 @@
render(Meetings::EmailUpdatesBannerComponent.new(@meeting, override: :muted))
end
end
-
- if @copy_from
- modal_body.with_row do
- render(Meeting::CopiedFrom.new(f, id: @copy_from.id))
- end
-
- modal_body.with_row(mt: 3) do
- render(Meeting::CopyItems.new(f))
- end
-
- modal_body.with_row(mt: 3) do
- render(Meeting::CopyParticipants.new(f))
- end
-
- modal_body.with_row(mt: 3) do
- render(Meeting::CopyAttachments.new(f))
- end
-
- modal_body.with_row(mt: 3) do
- render(Meeting::EmailParticipants.new(f))
- end
- end
end
end
end
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index 17bf15f6519..620cff93d1d 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -469,7 +469,6 @@ class MeetingsController < ApplicationController
@converted_params[:project] = @project if @project.present?
@converted_params[:duration] = @converted_params[:duration].to_hours if @converted_params[:duration].present?
- @converted_params[:send_notifications] = params[:send_notifications] == "1"
# Handle participants separately for each meeting type
@converted_params[:participants_attributes] ||= {}
@@ -540,7 +539,7 @@ class MeetingsController < ApplicationController
{
copy_agenda: copy_param(:copy_agenda),
copy_attachments: copy_param(:copy_attachments),
- send_notifications: copy_param(:send_notifications)
+ send_notifications: meeting_params[:notify] == "1" && params[:meeting][:copied_from_meeting_id].present?
}
end
diff --git a/modules/meeting/app/forms/meeting/email_participants.rb b/modules/meeting/app/forms/meeting/email_participants.rb
deleted file mode 100644
index 3ff273b6370..00000000000
--- a/modules/meeting/app/forms/meeting/email_participants.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# frozen_string_literal: true
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-class Meeting::EmailParticipants < ApplicationForm
- form do |meeting_form|
- meeting_form.check_box(
- name: "send_notificationss",
- label: I18n.t("meeting.email.send_emails"),
- checked: false,
- caption: I18n.t("meeting.email.send_invitation_emails_structured")
- )
- end
-end
diff --git a/modules/meeting/app/forms/meeting/send_email_updates.rb b/modules/meeting/app/forms/meeting/send_email_updates.rb
index bd9a4f57c24..3791c9cd109 100644
--- a/modules/meeting/app/forms/meeting/send_email_updates.rb
+++ b/modules/meeting/app/forms/meeting/send_email_updates.rb
@@ -33,7 +33,7 @@ class Meeting::SendEmailUpdates < ApplicationForm
meeting_form.check_box(
name: "notify",
label: I18n.t("label_meeting_send_updates"),
- checked: @meeting.notify? != false,
+ checked: checked?,
data: {
"show-when-checked-target": "cause",
"show-when-checked-target-name": "notification-banner"
@@ -41,9 +41,16 @@ class Meeting::SendEmailUpdates < ApplicationForm
)
end
- def initialize(meeting:)
+ def initialize(meeting:, copy_from:)
super()
@meeting = meeting
+ @copy_from = copy_from
+ end
+
+ def checked?
+ return true unless @copy_from.nil?
+
+ @meeting.notify? != false
end
end