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 recurring meetings

Mir Bhatia39bac55f4697
diff --git a/modules/meeting/app/mailers/meeting_series_mailer.rb b/modules/meeting/app/mailers/meeting_series_mailer.rb
index ea9b3bf3488..ba08b387c9b 100644
--- a/modules/meeting/app/mailers/meeting_series_mailer.rb
+++ b/modules/meeting/app/mailers/meeting_series_mailer.rb
@@ -43,7 +43,7 @@ class MeetingSeriesMailer < UserMailer
end
end
- def rescheduled(series, user, actor, changes:)
+ def updated(series, user, actor, changes:)
@actor = actor
@series = series
@user = user
@@ -52,7 +52,7 @@ class MeetingSeriesMailer < UserMailer
set_headers(series)
with_attached_ics(series, user) do
- subject = I18n.t("meeting.email.series_rescheduled.title", title: series.title, project_name: series.project.name)
+ subject = I18n.t("meeting.email.series_updated.title", title: series.title, project_name: series.project.name)
mail(to: user, subject:)
end
end
diff --git a/modules/meeting/app/models/recurring_meeting.rb b/modules/meeting/app/models/recurring_meeting.rb
index d552f401fed..5eda21ce0ce 100644
--- a/modules/meeting/app/models/recurring_meeting.rb
+++ b/modules/meeting/app/models/recurring_meeting.rb
@@ -216,7 +216,7 @@ class RecurringMeeting < ApplicationRecord
def reschedule_required?(previous: false)
(previous ? previous_changes : changes)
.keys
- .intersect?(%w[frequency start_date start_time start_time_hour iterations interval end_after end_date])
+ .intersect?(%w[frequency start_date start_time start_time_hour iterations interval end_after end_date location])
end
def scheduled_occurrences(limit:)
diff --git a/modules/meeting/app/services/recurring_meetings/update_service.rb b/modules/meeting/app/services/recurring_meetings/update_service.rb
index 21c2344ed91..d4033dfe063 100644
--- a/modules/meeting/app/services/recurring_meetings/update_service.rb
+++ b/modules/meeting/app/services/recurring_meetings/update_service.rb
@@ -36,6 +36,7 @@ module RecurringMeetings
def validate_params
@old_schedule = model.full_schedule_in_words
+ @old_location = model.template.location
super
end
@@ -47,7 +48,7 @@ module RecurringMeetings
if should_reschedule?(recurring_meeting)
reschedule_future_occurrences(recurring_meeting)
reschedule_init_job(recurring_meeting)
- send_rescheduled_mail(recurring_meeting)
+ send_updated_mail(recurring_meeting)
end
cleanup_cancelled_schedules(recurring_meeting)
@@ -150,7 +151,7 @@ module RecurringMeetings
end
end
- def send_rescheduled_mail(recurring_meeting)
+ def send_updated_mail(recurring_meeting)
return unless recurring_meeting.notify?
recurring_meeting
@@ -158,12 +159,12 @@ module RecurringMeetings
.participants
.invited
.find_each do |participant|
- MeetingSeriesMailer.rescheduled(
+ MeetingSeriesMailer.updated(
recurring_meeting,
participant.user,
User.current,
- changes: { old_schedule: @old_schedule }
- ).deliver_later
+ changes: { old_schedule: @old_schedule, old_location: @old_location }
+ ).deliver_now
end
end
diff --git a/modules/meeting/app/views/meeting_mailer/updated.html.erb b/modules/meeting/app/views/meeting_mailer/updated.html.erb
index 4c8065bd190..112ae3166e7 100644
--- a/modules/meeting/app/views/meeting_mailer/updated.html.erb
+++ b/modules/meeting/app/views/meeting_mailer/updated.html.erb
@@ -75,6 +75,7 @@ See COPYRIGHT and LICENSE files for more details.
</td>
</tr>
<% end %>
+
<% if @changes[:old_location].present? || @changes[:new_location].present? %>
<% if @changes[:old_location] != @changes[:new_location] %>
<tr>
@@ -106,6 +107,7 @@ See COPYRIGHT and LICENSE files for more details.
</tr>
<% end %>
<% end %>
+
<tr>
<td style="<%= placeholder_text_styles(width: "30%") %>">
<%= Meeting.human_attribute_name(:project) %>
@@ -122,6 +124,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= @meeting.author %>
</td>
</tr>
+
<% if @meeting.participants.exists? %>
<tr>
<td style="<%= placeholder_text_styles(width: "30%") %>">
diff --git a/modules/meeting/app/views/meeting_series_mailer/rescheduled.html.erb b/modules/meeting/app/views/meeting_series_mailer/updated.html.erb
similarity index 58%
rename from modules/meeting/app/views/meeting_series_mailer/rescheduled.html.erb
rename to modules/meeting/app/views/meeting_series_mailer/updated.html.erb
index 85ef00eb537..29c2f639d17 100644
--- a/modules/meeting/app/views/meeting_series_mailer/rescheduled.html.erb
+++ b/modules/meeting/app/views/meeting_series_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.series_rescheduled.summary", title: @series.title, actor: @actor),
+ summary: I18n.t("meeting.email.series_updated.summary", title: @series.title, actor: @actor),
bottom_spacing: false
} %>
@@ -40,9 +40,10 @@ See COPYRIGHT and LICENSE files for more details.
<%= placeholder_cell("24px", vertical: true) %>
<td>
<table>
+ <% if @changes[:old_schedule] != @series.full_schedule_in_words %>
<tr>
<td style="<%= placeholder_text_styles(width: "30%") %>">
- <%= t("meeting.email.series_rescheduled.old_schedule") %>
+ <%= t("meeting.email.series_updated.old_schedule") %>:
</td>
<td style="<%= placeholder_text_styles %>">
<s>
@@ -52,12 +53,55 @@ See COPYRIGHT and LICENSE files for more details.
</tr>
<tr>
<td style="<%= placeholder_text_styles(width: "30%") %>">
- <%= t("meeting.email.series_rescheduled.new_schedule") %>
+ <%= t("meeting.email.series_updated.new_schedule") %>:
</td>
- <td style="<%= placeholder_text_styles("font-weight": "bold") %>">
+ <td style="<%= placeholder_text_styles(color: "#1f2328", "font-weight": "bold") %>">
<%= @series.full_schedule_in_words %> (<%= formatted_time_zone_offset %>)
</td>
</tr>
+ <% else %>
+ <tr>
+ <td style="<%= placeholder_text_styles(width: "30%") %>">
+ <%= I18n.t(:label_recurring_meeting_schedule) %>:
+ </td>
+ <td style="<%= placeholder_text_styles %>">
+ <%= @series.full_schedule_in_words %> (<%= formatted_time_zone_offset %>)
+ </td>
+ </tr>
+ <% end %>
+
+ <% if @changes[:old_location].present? || @series.location.present? %>
+ <% if @changes[:old_location] != @series.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") %>">
+ <%= @series.location.blank? ? "-" : (auto_link @series.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 @series.location %>
+ </td>
+ </tr>
+ <% end %>
+ <% end %>
+
<tr>
<td style="<%= placeholder_text_styles(width: "30%") %>">
<%= Meeting.human_attribute_name(:project) %>
@@ -66,6 +110,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= link_to @series.project.name, project_url(@series.project) %>
</td>
</tr>
+
<tr>
<td style="<%= placeholder_text_styles(width: "30%") %>">
<%= Meeting.human_attribute_name(:author) %>
diff --git a/modules/meeting/app/views/meeting_series_mailer/rescheduled.text.erb b/modules/meeting/app/views/meeting_series_mailer/updated.text.erb
similarity index 62%
rename from modules/meeting/app/views/meeting_series_mailer/rescheduled.text.erb
rename to modules/meeting/app/views/meeting_series_mailer/updated.text.erb
index 594b498e796..d6691b2414a 100644
--- a/modules/meeting/app/views/meeting_series_mailer/rescheduled.text.erb
+++ b/modules/meeting/app/views/meeting_series_mailer/updated.text.erb
@@ -30,12 +30,32 @@ See COPYRIGHT and LICENSE files for more details.
<%= @series.project.name %>: <%= @series.title %> (<%= recurring_meeting_url(@series) %>)
<%= @series.author %>
-<%= t('meeting.email.series_rescheduled.summary',
+<%= t(
+ "meeting.email.series_updated.summary",
actor: @actor,
- title: @series.title) %>
+ title: @series.title
+ ) %>
-<%= t('meeting.email.series_rescheduled.old_schedule') %>:
+<% if @changes[:old_schedule] != @series.full_schedule_in_words %>
+<%= t("meeting.email.series_updated.old_schedule") %>:
<%= @changes[:old_schedule] %> (<%= formatted_time_zone_offset %>)
-<%= t('meeting.email.series_rescheduled.new_schedule') %>:
+<%= t("meeting.email.series_updated.new_schedule") %>:
<%= @series.full_schedule_in_words %> (<%= formatted_time_zone_offset %>)
+<% else %>
+<%= I18n.t(:label_recurring_meeting_schedule) %>
+<%= @series.full_schedule_in_words %> (<%= formatted_time_zone_offset %>)
+<% end %>
+
+<% if @changes[:old_location].present? || @series.location.present? %>
+<% if @changes[:old_location] != @series.location %>
+<%= t("meeting.email.updated.old_location") %>:
+<%= @changes[:old_location].presence || "-" %>
+
+<%= t("meeting.email.updated.new_location") %>:
+<%= @series.location.blank? ? "-" : (auto_link @series.location) %>
+<% else %>
+<%= Meeting.human_attribute_name(:location) %>:
+<%= auto_link @series.location %>
+<% end %>
+<% end %>
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index ca4dab0e3a4..8a99b284c57 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -232,9 +232,9 @@ en:
series:
title: "[%{project_name}] Meeting series '%{title}'"
summary: "%{actor} has set up a new meeting series '%{title}'"
- series_rescheduled:
- title: "[%{project_name}] Meeting series '%{title}' rescheduled"
- summary: "%{actor} has changed the schedule for meeting series '%{title}'"
+ series_updated:
+ title: "[%{project_name}] Meeting series '%{title}' has been updated"
+ summary: "Meeting series '%{title}' has been updated by %{actor}"
old_schedule: "Old schedule"
new_schedule: "New schedule"
invited: