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
Adapt text-only version of the daily email
Henriette Dargea864b716c75a
diff --git a/app/helpers/mail_digest_helper.rb b/app/helpers/mail_digest_helper.rbindex f9db3cb4878..de132d39643 100644--- a/app/helpers/mail_digest_helper.rb+++ b/app/helpers/mail_digest_helper.rb@@ -37,13 +37,21 @@ module MailDigestHelperend: format_time(end_time))end- def digest_notification_timestamp_text(notification, html: true)+ def digest_notification_timestamp_text(notification, html: true, extended_text: false)journal = notification.journaluser = html ? link_to_user(journal.user, only_path: false) : journal.user.name- raw(I18n.t(:"mail.digests.work_packages.#{journal.initial? ? 'created_at' : 'updated_at'}",- user: user,- timestamp: time_ago_in_words(journal.created_at)))+ if extended_text+ raw(I18n.t(:"mail.digests.work_packages.#{journal.initial? ? 'created' : 'updated'}") ++ ' ' ++ I18n.t(:"mail.digests.work_packages.#{journal.initial? ? 'created_at' : 'updated_at'}",+ user: user,+ timestamp: time_ago_in_words(journal.created_at)))+ else+ raw(I18n.t(:"mail.digests.work_packages.#{journal.initial? ? 'created_at' : 'updated_at'}",+ user: user,+ timestamp: time_ago_in_words(journal.created_at)))+ endenddef unique_reasons_of_notifications(notifications)diff --git a/app/mailers/digest_mailer.rb b/app/mailers/digest_mailer.rbindex 9a6fae4b42d..b294e484467 100644--- a/app/mailers/digest_mailer.rb+++ b/app/mailers/digest_mailer.rb@@ -57,10 +57,6 @@ class DigestMailer < ApplicationMailer@aggregated_notifications = load_notifications(notification_ids).group_by(&:resource)- @notifications_by_project = load_notifications(notification_ids)- .group_by(&:project)- .transform_values { |of_project| of_project.group_by(&:resource) }-return if @aggregated_notifications.empty?with_locale_for(recipient) dodiff --git a/app/views/digest_mailer/work_packages.text.erb b/app/views/digest_mailer/work_packages.text.erbindex 71e617d0b4c..c80ea98ec9a 100644--- a/app/views/digest_mailer/work_packages.text.erb+++ b/app/views/digest_mailer/work_packages.text.erb@@ -1,36 +1,27 @@-<%= digest_timespan_text %>+<% @aggregated_notifications.each do | work_package, notifications_by_work_package| %>-<% @notifications_by_project.each do |project, notifications_by_work_package| %>+ <%= "=" * (('# ' + work_package.id.to_s + work_package.subject).length + 4) %>+ = #<%= work_package.id %> <%= work_package.subject %> =+ <%= "=" * (('# ' + work_package.id.to_s + work_package.subject).length + 4) %>-<%= "=" * (project.name.length + 4) %>-= <%= project.name %> =-<%= "=" * (project.name.length + 4) %>+ <% notifications_by_work_package.each do | notification | %>+ <%= "-" * 20 %>-<% notifications_by_work_package.each do |work_package, notifications| %>+ <%= digest_notification_timestamp_text(+ notification,+ html: false,+ extended_text: true) %> (<%= I18n.t('mail.digests.work_packages.reason.prefix',+ reason: I18n.t(:"mail.digests.work_packages.reason.#{notification.reason_mail_digest}")) %>)-<%= "*" * (work_package.to_s.length + 4) %>-* <%= work_package.to_s %> *-<%= "*" * (work_package.to_s.length + 4) %>+ <% journal = notification.journal %>+ <% if journal.notes.present? %>+ <%= journal.notes %>-<% notifications.sort_by(&:created_at).each do |notification| %>+ <% end %>+ <% journal.details.each do |detail| %>+ * <%= journal.render_detail(detail, only_path: false, no_html: true) %>+ <% end %>-<%= "-" * 20 %>--<%= digest_notification_timestamp_text(notification, html: false) %> (<%= I18n.t('mail.digests.work_packages.reason.prefix',- reason: I18n.t(:"mail.digests.work_packages.reason.#{notification.reason_mail_digest}")) %>)--<% journal = notification.journal %>-<% if journal.notes.present? %>-<%= journal.notes %>--<% end %>-<% journal.details.each do |detail| %>- * <%= journal.render_detail(detail, only_path: false, no_html: true) %>-<% end %>-<% end %>--<%= "-" * 20 %>---<% end %>+ <%= "-" * 20 %>+ <% end %><% end %>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex a631cb103f1..05295a47256 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1969,6 +1969,7 @@ en:digests:time_frame: 'Summary of all events you subscribed to in the period between %{start} and %{end}'work_packages:+ created: 'Created'created_at: 'by %{user} %{timestamp} ago'reason:watched: 'watched'@@ -1977,6 +1978,7 @@ en:subscribed: 'all'prefix: 'Received because of the notification setting: %{reason}'subject: 'Daily project summary for %{date} - %{number} updates'+ updated: 'Updated'updated_at: '%{timestamp} ago by %{user}'mail_body_account_activation_request: "A new user (%{value}) has registered. The account is pending your approval:"