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 emails for regular meetings

Mir Bhatia748a14f627b6
diff --git a/modules/meeting/app/mailers/meeting_mailer.rb b/modules/meeting/app/mailers/meeting_mailer.rb
index fbbb75f5d2a..0eb3045171f 100644
--- a/modules/meeting/app/mailers/meeting_mailer.rb
+++ b/modules/meeting/app/mailers/meeting_mailer.rb
@@ -43,7 +43,7 @@ class MeetingMailer < UserMailer
end
end
- def rescheduled(meeting, user, actor, changes:)
+ def updated(meeting, user, actor, changes:)
@actor = actor
@user = user
@meeting = meeting
@@ -54,7 +54,7 @@ class MeetingMailer < UserMailer
with_attached_ics(meeting, user) do
subject = "[#{@meeting.project.name}] "
- subject << I18n.t("meeting.email.rescheduled.header", title: @meeting.title)
+ subject << I18n.t("meeting.email.updated.header", title: @meeting.title)
mail(to: user, subject:)
end
end
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index fd69113179c..60fbb736c3f 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -117,7 +117,7 @@ class Meeting < ApplicationRecord
before_save :add_new_participants_as_watcher
- after_update :send_rescheduling_mail, if: -> { saved_change_to_start_time? || saved_change_to_duration? }
+ after_update :send_updated_mail, if: -> { saved_change_to_start_time? || saved_change_to_duration? || saved_change_to_location? }
enum :state, {
open: 0, # 0 -> default, leave values for future states between open and closed
@@ -267,17 +267,23 @@ class Meeting < ApplicationRecord
end
end
- def send_rescheduling_mail
+ def send_updated_mail
return if templated? || new_record? || !notify?
MeetingNotificationService
.new(self)
- .call :rescheduled,
- changes: {
- old_start: saved_change_to_start_time? ? saved_change_to_start_time.first : start_time,
- new_start: start_time,
- old_duration: saved_change_to_duration? ? saved_change_to_duration.first : duration,
- new_duration: duration
- }
+ .call :updated,
+ changes: updated_mail_changes
+ end
+
+ def updated_mail_changes
+ {
+ old_start: saved_change_to_start_time? ? saved_change_to_start_time.first : start_time,
+ new_start: start_time,
+ old_duration: saved_change_to_duration? ? saved_change_to_duration.first : duration,
+ new_duration: duration,
+ old_location: saved_change_to_location? ? saved_change_to_location.first : location,
+ new_location: location
+ }
end
end
diff --git a/modules/meeting/app/views/meeting_mailer/rescheduled.html.erb b/modules/meeting/app/views/meeting_mailer/updated.html.erb
similarity index 53%
rename from modules/meeting/app/views/meeting_mailer/rescheduled.html.erb
rename to modules/meeting/app/views/meeting_mailer/updated.html.erb
index 0806594e5e0..4c8065bd190 100644
--- a/modules/meeting/app/views/meeting_mailer/rescheduled.html.erb
+++ b/modules/meeting/app/views/meeting_mailer/updated.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= render partial: "mailer/mailer_header",
locals: {
user: @user,
- summary: I18n.t("meeting.email.rescheduled.summary", title: @meeting.title, actor: @actor),
+ summary: I18n.t("meeting.email.updated.summary", title: @meeting.title, actor: @actor),
bottom_spacing: false
} %>
@@ -40,38 +40,72 @@ See COPYRIGHT and LICENSE files for more details.
<%= placeholder_cell("24px", vertical: true) %>
<td>
<table>
- <tr>
- <td style="<%= placeholder_text_styles(width: "30%") %>">
- <%= t("meeting.email.rescheduled.old_date_time") %>
- </td>
- <td style="<%= placeholder_text_styles %>">
- <s>
- <%= format_date @changes[:old_start] %> <%= format_time @changes[:old_start], include_date: false %>
+ <% if @changes[:old_start] != @changes[:new_start] || @changes[:old_duration] != @changes[:new_duration] %>
+ <tr>
+ <td style="<%= placeholder_text_styles(width: "30%") %>">
+ <%= t("meeting.email.updated.old_date_time") %>
+ </td>
+ <td style="<%= placeholder_text_styles %>">
+ <s>
+ <%= format_date @changes[:old_start] %> <%= format_time @changes[:old_start], include_date: false %>
+ -
+ <%= format_time (@changes[:old_start] + @changes[:old_duration].hours), include_date: false %> (<%= formatted_time_zone_offset %>)
+ </s>
+ </td>
+ </tr>
+ <tr>
+ <td style="<%= placeholder_text_styles(width: "30%") %>">
+ <%= t("meeting.email.updated.new_date_time") %>
+ </td>
+ <td style="<%= placeholder_text_styles(color: "#1f2328", "font-weight": "bold") %>">
+ <%= format_date @changes[:new_start] %> <%= format_time @changes[:new_start], include_date: false %>
-
- <%= format_time (@changes[:old_start] + @changes[:old_duration].hours), include_date: false %> (<%= formatted_time_zone_offset %>)
- </s>
- </td>
- </tr>
- <tr>
- <td style="<%= placeholder_text_styles(width: "30%") %>">
- <%= t("meeting.email.rescheduled.new_date_time") %>
- </td>
- <td style="<%= placeholder_text_styles("font-weight": "bold") %>">
- <%= format_date @changes[:new_start] %> <%= format_time @changes[:new_start], include_date: false %>
- -
- <%= format_time (@changes[:new_start] + @changes[:new_duration].hours), include_date: false %> (<%= formatted_time_zone_offset %>)
- </td>
- </tr>
- <% if @meeting.location.present? %>
+ <%= format_time (@changes[:new_start] + @changes[:new_duration].hours), include_date: false %> (<%= formatted_time_zone_offset %>)
+ </td>
+ </tr>
+ <% else %>
<tr>
<td style="<%= placeholder_text_styles(width: "30%") %>">
- <%= Meeting.human_attribute_name(:location) %>
+ <%= I18n.t(:label_meeting_date_time) %>
</td>
<td style="<%= placeholder_text_styles %>">
- <%= auto_link @meeting.location %>
+ <%= format_date @changes[:new_start] %> <%= format_time @changes[:new_start], include_date: false %>
+ -
+ <%= format_time (@changes[:new_start] + @changes[:new_duration].hours), include_date: false %> (<%= formatted_time_zone_offset %>)
</td>
</tr>
<% end %>
+ <% if @changes[:old_location].present? || @changes[:new_location].present? %>
+ <% if @changes[:old_location] != @changes[:new_location] %>
+ <tr>
+ <td style="<%= placeholder_text_styles(width: "30%") %>">
+ <%= t("meeting.email.updated.old_location") %>
+ </td>
+ <td style="<%= placeholder_text_styles %>">
+ <s>
+ <%= @changes[:old_location].presence || "-" %>
+ </s>
+ </td>
+ </tr>
+ <tr>
+ <td style="<%= placeholder_text_styles(width: "30%") %>">
+ <%= t("meeting.email.updated.new_location") %>
+ </td>
+ <td style="<%= placeholder_text_styles(color: "#1f2328", "font-weight": "bold") %>">
+ <%= @changes[:new_location].blank? ? "-" : (auto_link @changes[:new_location]) %>
+ </td>
+ </tr>
+ <% else %>
+ <tr>
+ <td style="<%= placeholder_text_styles(width: "30%") %>">
+ <%= Meeting.human_attribute_name(:location) %>
+ </td>
+ <td style="<%= placeholder_text_styles %>">
+ <%= auto_link @changes[:new_location] %>
+ </td>
+ </tr>
+ <% end %>
+ <% end %>
<tr>
<td style="<%= placeholder_text_styles(width: "30%") %>">
<%= Meeting.human_attribute_name(:project) %>
@@ -121,6 +155,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= link_to I18n.t(:"meeting.email.open_meeting_link"),
meeting_url(@meeting),
target: "_blank",
+ rel: "noopener",
style: "color: #333333; text-decoration: none; font-size: 14px;white-space: nowrap;" %>
<% end %>
<% end %>
diff --git a/modules/meeting/app/views/meeting_mailer/rescheduled.text.erb b/modules/meeting/app/views/meeting_mailer/updated.text.erb
similarity index 56%
rename from modules/meeting/app/views/meeting_mailer/rescheduled.text.erb
rename to modules/meeting/app/views/meeting_mailer/updated.text.erb
index d85d3159197..dd3ee55b990 100644
--- a/modules/meeting/app/views/meeting_mailer/rescheduled.text.erb
+++ b/modules/meeting/app/views/meeting_mailer/updated.text.erb
@@ -31,13 +31,33 @@ See COPYRIGHT and LICENSE files for more details.
<%= @meeting.author %>
<%= t(
- "meeting.email.rescheduled.body",
+ "meeting.email.updated.body",
actor: @actor,
title: @meeting.title
) %>
-<%= t("meeting.email.rescheduled.old_date_time") %>:
-<%= format_date @changes[:old_start] %> <%= format_time @changes[:old_start], include_date: false %> - <%= format_time (@changes[:old_start] + @changes[:old_duration]), include_date: false %> (<%= formatted_time_zone_offset %>}
-
-<%= t("meeting.email.rescheduled.new_date_time") %>:
-<%= format_date @changes[:new_start] %> <%= format_time @changes[:new_start], include_date: false %> - <%= format_time (@changes[:new_start] + @changes[:new_duration]), include_date: false %> (<%= formatted_time_zone_offset %>}
+<% if @changes[:old_start] != @changes[:new_start] || @changes[:old_duration] != @changes[:new_duration] %>
+<%= t("meeting.email.updated.old_date_time") %>:
+<%= format_date @changes[:old_start] %> <%= format_time @changes[:old_start], include_date: false %> - <%= format_time (@changes[:old_start] + @changes[:old_duration].hours), include_date: false %> (<%= formatted_time_zone_offset %>}
+
+<%= t("meeting.email.updated.new_date_time") %>:
+<%= format_date @changes[:new_start] %> <%= format_time @changes[:new_start], include_date: false %> - <%= format_time (@changes[:new_start] + @changes[:new_duration].hours), include_date: false %> (<%= formatted_time_zone_offset %>}
+<% else %>
+<%= I18n.t(:label_meeting_date_time) %>:
+<%= format_date @changes[:new_start] %> <%= format_time @changes[:new_start], include_date: false %>
+-
+<%= format_time (@changes[:new_start] + @changes[:new_duration].hours), include_date: false %> (<%= formatted_time_zone_offset %>)
+<% end %>
+
+<% if @changes[:old_location].present? || @changes[:new_location].present? %>
+<% if @changes[:old_location] != @changes[:new_location] %>
+<%= t("meeting.email.updated.old_location") %>:
+<%= @changes[:old_location].presence || "-" %>
+
+<%= t("meeting.email.updated.new_location") %>:
+<%= @changes[:new_location].blank? ? "-" : (auto_link @changes[:new_location]) %>
+<% else %>
+<%= Meeting.human_attribute_name(:location) %>:
+<%= auto_link @changes[:new_location] %>
+<% end %>
+<% end %>
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index ffccccd2211..ca4dab0e3a4 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -247,12 +247,14 @@ en:
summary_series: "Meeting series '%{title}' has been cancelled by %{actor}."
summary: "'%{title}' has been cancelled by %{actor}."
date_time: "Scheduled date/time"
- rescheduled:
- header: "Meeting '%{title}' has been rescheduled"
- summary: "Meeting '%{title}' has been rescheduled by %{actor}"
- body: "The meeting '%{title}' has been rescheduled by %{actor}."
+ updated:
+ header: "Meeting '%{title}' has been updated"
+ summary: "Meeting '%{title}' has been updated by %{actor}"
+ body: "The meeting '%{title}' has been updated by %{actor}."
old_date_time: "Old date/time"
new_date_time: "New date/time"
+ old_location: "Old location"
+ new_location: "New location"
label_mail_all_participants: "Send email invite to participants"
types:
one_time: "One-time"