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

Allow sending notifications for invited users

Oliver Güntherd0a2e904426d
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index d71402442d9..69941b8157f 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -315,6 +315,7 @@ class MeetingsController < ApplicationController
# Force defaults on participants
@converted_params[:participants_attributes] ||= {}
@converted_params[:participants_attributes].each { |p| p.reverse_merge! attended: false, invited: false }
+ @converted_params[:send_notifications] = params[:send_notifications] == '1'
end
def meeting_params
diff --git a/modules/meeting/app/services/meetings/create_service.rb b/modules/meeting/app/services/meetings/create_service.rb
index cc5e874eed9..defc3399d97 100644
--- a/modules/meeting/app/services/meetings/create_service.rb
+++ b/modules/meeting/app/services/meetings/create_service.rb
@@ -41,5 +41,19 @@ module Meetings
Meeting.new
end
end
+
+ def after_perform(call)
+ if call.success? && Journal::NotificationConfiguration.active?
+ meeting = call.result
+
+ meeting.participants.where(invited: true).each do |participant|
+ MeetingMailer
+ .invited(meeting, participant.user, User.current)
+ .deliver_later
+ end
+ end
+
+ call
+ end
end
end
diff --git a/modules/meeting/app/views/meetings/_form.html.erb b/modules/meeting/app/views/meetings/_form.html.erb
index cf74a6c7837..a7503983050 100644
--- a/modules/meeting/app/views/meetings/_form.html.erb
+++ b/modules/meeting/app/views/meetings/_form.html.erb
@@ -191,4 +191,16 @@ See COPYRIGHT and LICENSE files for more details.
</div>
<%= render partial: 'meetings/participants_section' %>
+
+ <div class="form--field">
+ <%= styled_label_tag 'send_notfications', t(:"meeting.email.send_emails") %>
+ <div class="form--field-container">
+ <%= styled_check_box_tag 'send_notifications',
+ 1,
+ true %>
+ </div>
+ <div class="form--field-instructions">
+ <%= t(:"meeting.email.send_invitation_emails") %>
+ </div>
+ </div>
</section>
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index 2064001e8f6..647c8420c80 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -122,6 +122,8 @@ en:
agenda: "Copy agenda"
agenda_text: "Copy the agenda of the old meeting"
email:
+ send_emails: "Send emails"
+ send_invitation_emails: "Send out invitation emails upon creation"
open_meeting_link: "Open meeting"
invited:
summary: "%{actor} has sent you an invitation for the meeting %{title}"