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
Added mail template for healthy storage notification
Andreas Pfohld9ac8d0ca870
diff --git a/app/views/announcement_mailer/announce.html.erb b/app/views/announcement_mailer/announce.html.erbindex 824b9cbb073..98cd760e4a9 100644--- a/app/views/announcement_mailer/announce.html.erb+++ b/app/views/announcement_mailer/announce.html.erb@@ -44,5 +44,9 @@</tr></table>- <%= render partial: 'mailer/notification_settings_table' %>+ <%= render partial: 'mailer/notification_settings_table',+ locals: {+ button_url: my_reminders_url,+ button_text: I18n.t(:'mail.notification.settings')+ } %><% end %>diff --git a/app/views/digest_mailer/work_packages.html.erb b/app/views/digest_mailer/work_packages.html.erbindex 38b35e85a5d..eb6aed6410a 100644--- a/app/views/digest_mailer/work_packages.html.erb+++ b/app/views/digest_mailer/work_packages.html.erb@@ -4,7 +4,7 @@</tr></table>-<table <%= placeholder_table_styles(width:'100%',style: 'width:100%;max-width:700px;') %>>+<table <%= placeholder_table_styles(width: '100%', style: 'width:100%;max-width:700px;') %>><tr><%= placeholder_cell('12px', vertical: true) %><td>@@ -40,7 +40,11 @@<% end %><% end %>- <%= render layout: 'mailer/notification_settings_table' do %>+ <%= render layout: 'mailer/notification_settings_table',+ locals: {+ button_url: my_reminders_url,+ button_text: I18n.t(:'mail.notification.settings')+ } do %><% if @aggregated_notifications.length > DigestMailer::MAX_SHOWN_WORK_PACKAGES %><table><tr>diff --git a/app/views/mailer/_mailer_header.html.erb b/app/views/mailer/_mailer_header.html.erbindex 3859afc37b8..e1ca6e830d1 100644--- a/app/views/mailer/_mailer_header.html.erb+++ b/app/views/mailer/_mailer_header.html.erb@@ -46,7 +46,7 @@<% end %><% if local_assigns[:bottom_spacing] != false %><tr>- <%= placeholder_cell('40px', vertical: false) %>+ <%= placeholder_cell('16px', vertical: false) %></tr><% end %></table>diff --git a/app/views/mailer/_notification_settings_button.html.erb b/app/views/mailer/_notification_settings_button.html.erbindex 39566ee77e2..40138724132 100644--- a/app/views/mailer/_notification_settings_button.html.erb+++ b/app/views/mailer/_notification_settings_button.html.erb@@ -1,10 +1,10 @@<table <%= placeholder_table_styles %>><tr><td style="padding: 8px 12px; border: 1px solid #878787; border-radius: 16px; overflow: hidden; text-overflow: ellipsis;white-space: nowrap;">- <a href="<%= my_reminders_url %>"+ <a href="<%= url %>"target="_blank"style="color: #333333; text-decoration: none; font-size: 14px;white-space: nowrap;">- <%= I18n.t(:'mail.notification.settings') %>+ <%= text %></a></td></tr>diff --git a/app/views/mailer/_notification_settings_table.html.erb b/app/views/mailer/_notification_settings_table.html.erbindex 13674c52c27..1df5ab15a2c 100644--- a/app/views/mailer/_notification_settings_table.html.erb+++ b/app/views/mailer/_notification_settings_table.html.erb@@ -1,7 +1,7 @@<table <%= placeholder_table_styles(style: 'font-size:14px;') %>><tr><td>- <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;') %>>+ <table <%= placeholder_table_styles(width: '100%', style: 'width:100%;') %>><tr><td><%= yield %>@@ -11,7 +11,10 @@</td><%= placeholder_cell('10px', vertical: true) %><td>- <%= render partial: 'mailer/notification_settings_button' %>+ <%= render partial: 'mailer/notification_settings_button', locals: {+ url: button_url,+ text: button_text+ } %></td></tr></table>diff --git a/app/views/sharing_mailer/shared_work_package.html.erb b/app/views/sharing_mailer/shared_work_package.html.erbindex 64e6d067663..5455613ca7b 100644--- a/app/views/sharing_mailer/shared_work_package.html.erb+++ b/app/views/sharing_mailer/shared_work_package.html.erb@@ -32,7 +32,7 @@notification_url: @url,open_in_browser_path: @url} do %>- <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;') %>>+ <table <%= placeholder_table_styles(width: '100%', style: 'width:100%;') %>><tr><td style="<%= placeholder_text_styles %>"><%@@ -47,15 +47,19 @@</table><% end %>- <%= render partial: 'mailer/notification_settings_table' %>+ <%= render partial: 'mailer/notification_settings_table',+ locals: {+ button_url: my_reminders_url,+ button_text: I18n.t(:'mail.notification.settings')+ } %><% if @shared_with_user.invited? %>- <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;') %>>+ <table <%= placeholder_table_styles(width: '100%', style: 'width:100%;') %>><tr><%= placeholder_cell('20px', vertical: false) %></tr><tr>- <td style="color: #333333;font-size: 16px;">+ <td style="color: #333333; font-size: 16px;"><%= t('mail.sharing.work_packages.create_account', instance: Setting.app_title) %></td></tr>diff --git a/app/views/work_package_mailer/mentioned.html.erb b/app/views/work_package_mailer/mentioned.html.erbindex 3f4a333d98b..579cec2353c 100644--- a/app/views/work_package_mailer/mentioned.html.erb+++ b/app/views/work_package_mailer/mentioned.html.erb@@ -4,7 +4,7 @@</tr></table>-<table <%= placeholder_table_styles(width:'100%',style: 'width:100%;max-width:700px;') %>>+<table <%= placeholder_table_styles(width: '100%', style: 'width:100%;max-width:700px;') %>><tr><%= placeholder_cell('12px', vertical: true) %><td>@@ -23,7 +23,7 @@show_count: false,user: @user} do %>- <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;') %>>+ <table <%= placeholder_table_styles(width: '100%', style: 'width:100%;') %>><tr><td style="<%= placeholder_text_styles %>"><%= format_text @journal.notes, only_path: false %>@@ -32,7 +32,11 @@</table><% end %>- <%= render partial: 'mailer/notification_settings_table' %>+ <%= render partial: 'mailer/notification_settings_table',+ locals: {+ button_url: my_reminders_url,+ button_text: I18n.t(:'mail.notification.settings')+ } %><table><tr>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 34969e8e50a..5d33a1a6866 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2423,9 +2423,19 @@ en:group: "%{user} shared a work package with the group %{group} you are a member of"storages:health:+ email_notification_settings: "Storage email notification settings"see_storage_settings: "See storage settings"+ healthy:+ subject: "Storage \"%{name}\" is now healthy!"+ solved_at: "solved at"+ summary: "The problem with your %{storage_name} storage integration is now solved"unhealthy:+ subject: "Storage \"%{name}\" is unhealthy!"+ since: "since"summary: "There is a problem with your %{storage_name} storage integration"+ troubleshooting:+ text: "For more information, check file storages"+ link_text: "troubleshooting documentation"mail_body_account_activation_request: "A new user (%{value}) has registered. The account is pending your approval:"mail_body_account_information: "Your account information"diff --git a/modules/storages/app/mailers/storages/storages_mailer.rb b/modules/storages/app/mailers/storages/storages_mailer.rbindex 9433b93cbb3..50dbe4fcd1d 100644--- a/modules/storages/app/mailers/storages/storages_mailer.rb+++ b/modules/storages/app/mailers/storages/storages_mailer.rb@@ -43,15 +43,16 @@ module Storages@storage = storage@reason = storage.health_reason@url = edit_admin_settings_storage_url(storage)- subject = "Storage turned unhealthy!"+ subject = I18n.t('mail.storages.health.unhealthy.subject', name: @storage.name)mail(to: admin.mail, subject:)end- def notify_healthy(admin, storage)+ def notify_healthy(admin, storage, reason)@admin = admin@storage = storage+ @reason = reason@url = edit_admin_settings_storage_url(storage)- subject = "Storage is back healthy!"+ subject = I18n.t('mail.storages.health.healthy.subject', name: @storage.name)mail(to: admin.mail, subject:)endenddiff --git a/modules/storages/app/services/storages/health/health_service.rb b/modules/storages/app/services/storages/health/health_service.rbindex ccd75dc9cbb..dd109be5896 100644--- a/modules/storages/app/services/storages/health/health_service.rb+++ b/modules/storages/app/services/storages/health/health_service.rb@@ -7,11 +7,12 @@ module Storagesdef healthywas_unhealthy = @storage.health_unhealthy?+ reason = @storage.health_reason@storage.mark_as_healthyadmin_users.each do |admin|- ::Storages::StoragesMailer.notify_healthy(admin, @storage).deliver_now if was_unhealthy+ ::Storages::StoragesMailer.notify_healthy(admin, @storage, reason).deliver_now if was_unhealthyendenddiff --git a/modules/storages/app/views/storages/storages_mailer/_health_status_notification.html.erb b/modules/storages/app/views/storages/storages_mailer/_health_status_notification.html.erbindex c4d57376d71..51c52ebeedb 100644--- a/modules/storages/app/views/storages/storages_mailer/_health_status_notification.html.erb+++ b/modules/storages/app/views/storages/storages_mailer/_health_status_notification.html.erb@@ -9,13 +9,17 @@<table <%= placeholder_table_styles %>><tr><td>- <%= render Mailer::LabelComponent.new(scheme: :danger, text: 'Error') %>+ <% if state == :unhealthy %>+ <%= render Mailer::LabelComponent.new(scheme: :danger, text: 'Error') %>+ <% else %>+ <%= render Mailer::LabelComponent.new(scheme: :success, text: 'Healthy') %>+ <% end %></td><%= placeholder_cell('8px', vertical: true) %><td style="color: #878787; font-size: 12px; font-weight: 700;">- <%= storage_type %> - <%= storage_url %>+ <%= I18n.t("storages.provider_types.#{storage.short_provider_type}.name") %> - <%= storage.host %></td></tr></table>@@ -29,7 +33,7 @@<tr><%= placeholder_cell('12px', vertical: true) %>- <td style="font-weight: 700; line-height: 20px; color: black;"><%= storage_name %></td>+ <td style="font-weight: 700; line-height: 20px; color: black;"><%= storage.name %></td><%= placeholder_cell('12px', vertical: true) %></tr>@@ -39,16 +43,25 @@<tr id="reason"><%= placeholder_cell('12px', vertical: true) %>- <td style="color: #878787; font-size: 12px; font-weight: 400; line-height: 16px;"><%= reason %></td>+ <td style="color: #878787; font-size: 12px; font-weight: 400; line-height: 16px;">+ <% if state == :unhealthy %>+ <%= reason %> <%= I18n.t('mail.storages.health.unhealthy.since') %> <%= format_time(storage.health_changed_at) %>+ <% else %>+ <%= reason %> <%= I18n.t('mail.storages.health.healthy.solved_at') %> <%= format_time(storage.health_changed_at) %>+ <% end %>+ </td><%= placeholder_cell('12px', vertical: true) %></tr>- <% if is_nextcloud %>+ <% if storage.provider_type == ::Storages::Storage::PROVIDER_TYPE_NEXTCLOUD && state == :unhealthy %><tr id="troubleshooting"><%= placeholder_cell('12px', vertical: true) %>- <td style="color: #878787; font-size: 12px; font-weight: 400; line-height: 16px;">For more information,- check file storages <a href="<%= troubleshooting_url %>">troubleshooting documentation</a>.++ <td style="color: #878787; font-size: 12px; font-weight: 400; line-height: 16px;">+ <%= I18n.t('mail.storages.health.unhealthy.troubleshooting.text') %>+ <a href="<%= ::OpenProject::Static::Links[:storage_docs][:troubleshooting][:href] %>"><%= I18n.t('mail.storages.health.unhealthy.troubleshooting.link_text') %></a>.</td>+<%= placeholder_cell('12px', vertical: true) %></tr><% end %>diff --git a/modules/storages/app/views/storages/storages_mailer/notify_healthy.html.erb b/modules/storages/app/views/storages/storages_mailer/notify_healthy.html.erbindex db7c94d72cc..4640f76a670 100644--- a/modules/storages/app/views/storages/storages_mailer/notify_healthy.html.erb+++ b/modules/storages/app/views/storages/storages_mailer/notify_healthy.html.erb@@ -27,6 +27,36 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<!--<p><%#= link_to(@storage.name, storage_url(@storage)) %> (<%#= @storage.provider_type %>)</p>-->--<%= format_text @storage.health_reason %>+<table <%= placeholder_table_styles(width: '100%', style: 'width:100%;max-width:700px') %>>+ <tr>+ <td>+ <%= render(partial: 'mailer/mailer_header',+ locals: {+ user: @admin,+ summary: I18n.t("mail.storages.health.healthy.summary", storage_name: @storage.name),+ button_href: @url,+ button_text: I18n.t(:'mail.storages.health.see_storage_settings')+ }) %>++ <%= render(partial: 'health_status_notification',+ locals: {+ state: :healthy,+ storage: @storage,+ url: @url,+ reason: "#{Storages::Storage.extract_part_from_piped_string(@reason, 0)} - #{Storages::Storage.extract_part_from_piped_string(@reason, 1)}"+ }) %>++ <%#= render(partial: 'mailer/notification_settings_table',+ locals: {+ button_url: @url,+ button_text: I18n.t(:'mail.storages.health.email_notification_settings')+ }) %>++ <table>+ <tr>+ <%= placeholder_cell('13px', vertical: false) %>+ </tr>+ </table>+ </td>+ </tr>+</table>diff --git a/modules/storages/app/views/storages/storages_mailer/notify_healthy.text.erb b/modules/storages/app/views/storages/storages_mailer/notify_healthy.text.erbindex 41d983b1ab5..bf96035ca24 100644--- a/modules/storages/app/views/storages/storages_mailer/notify_healthy.text.erb+++ b/modules/storages/app/views/storages/storages_mailer/notify_healthy.text.erb@@ -27,7 +27,16 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<%= @storage.name %> (<%= @storage.provider_type %>)-<%#= storage_url(@storage) %>+<%= I18n.t('mail.salutation', user: @admin.firstname) %>-<%= @storage.health_reason %>+<%= "-" * 100 %>++<%= I18n.t("mail.storages.health.healthy.summary", storage_name: @storage.name) %>++<%= I18n.t("storages.provider_types.#{@storage.short_provider_type}.name") %> - <%= @storage.host %>++<%= "#{Storages::Storage.extract_part_from_piped_string(@reason, 0)} - #{Storages::Storage.extract_part_from_piped_string(@reason, 1)}" %> <%= I18n.t('mail.storages.health.healthy.solved_at') %> <%= format_time(@storage.health_changed_at) %>++<%= @url %>++<%= "-" * 100 %>diff --git a/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.html.erb b/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.html.erbindex 4da25a4a006..e604adef061 100644--- a/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.html.erb+++ b/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.html.erb@@ -40,14 +40,23 @@ See COPYRIGHT and LICENSE files for more details.<%= render(partial: 'health_status_notification',locals: {+ state: :unhealthy,+ storage: @storage,url: @url,- storage_name: @storage.name,- storage_type: I18n.t("storages.provider_types.#{@storage.short_provider_type}.name"),- storage_url: @storage.host,- reason: "#{@storage.health_reason_identifier} - #{@storage.health_reason_description}",- is_nextcloud: @storage.provider_type == ::Storages::Storage::PROVIDER_TYPE_NEXTCLOUD,- troubleshooting_url: ::OpenProject::Static::Links[:storage_docs][:troubleshooting][:href]+ reason: "#{@storage.health_reason_identifier} - #{@storage.health_reason_description}"}) %>++ <%#= render(partial: 'mailer/notification_settings_table',+ locals: {+ button_url: @url,+ button_text: I18n.t(:'mail.storages.health.email_notification_settings')+ }) %>++ <table>+ <tr>+ <%= placeholder_cell('13px', vertical: false) %>+ </tr>+ </table></td></tr></table>diff --git a/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.text.erb b/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.text.erbindex 26387caf337..39b4ba312a5 100644--- a/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.text.erb+++ b/modules/storages/app/views/storages/storages_mailer/notify_unhealthy.text.erb@@ -26,3 +26,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See COPYRIGHT and LICENSE files for more details.++#%>++<%= I18n.t('mail.salutation', user: @admin.firstname) %>++<%= "-" * 100 %>++<%= I18n.t("mail.storages.health.unhealthy.summary", storage_name: @storage.name) %>++<%= I18n.t("storages.provider_types.#{@storage.short_provider_type}.name") %> - <%= @storage.host %>++<%= "#{@storage.health_reason_identifier} - #{@storage.health_reason_description}" %> <%= I18n.t('mail.storages.health.unhealthy.since') %> <%= format_time(@storage.health_changed_at) %>++<%= @url %>++<%= "-" * 100 %>