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

Highlight type and status in email in the defined colors

Henriette Darge35004d4b352f
diff --git a/app/helpers/mail_digest_helper.rb b/app/helpers/mail_digest_helper.rb
index de132d39643..ee7d4f70512 100644
--- a/app/helpers/mail_digest_helper.rb
+++ b/app/helpers/mail_digest_helper.rb
@@ -29,6 +29,8 @@
#++
module MailDigestHelper
+ include ::ColorsHelper
+
def digest_timespan_text
end_time = Time.parse(Setting.notification_email_digest_time)
@@ -63,4 +65,14 @@ module MailDigestHelper
def notifications_path(id)
notifications_center_url(['details', id, 'activity'])
end
+
+ def type_color(type)
+ color_id = selected_color(type)
+ Color.find(color_id).hexcode
+ end
+
+ def status_colors(object)
+ color_id = selected_color(object)
+ Color.find(color_id).color_styles.map { |k, v| "#{k}:#{v};" }.join(' ')
+ end
end
diff --git a/app/mailers/digest_mailer.rb b/app/mailers/digest_mailer.rb
index b294e484467..06892f49012 100644
--- a/app/mailers/digest_mailer.rb
+++ b/app/mailers/digest_mailer.rb
@@ -55,6 +55,8 @@ class DigestMailer < ApplicationMailer
message_id nil, recipient
@aggregated_notifications = load_notifications(notification_ids)
+ .sort_by(&:created_at)
+ .reverse
.group_by(&:resource)
return if @aggregated_notifications.empty?
diff --git a/app/views/digest_mailer/work_packages.html.erb b/app/views/digest_mailer/work_packages.html.erb
index 8948c0e798f..dd7ce9ec90b 100644
--- a/app/views/digest_mailer/work_packages.html.erb
+++ b/app/views/digest_mailer/work_packages.html.erb
@@ -9,7 +9,7 @@
target="_blank">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom: 10px; font-size: 12px;">
<tr>
- <td style="background-color: #00CC00;
+ <td style="<%= status_colors(work_package.status) %>
white-space: nowrap;
padding: 0 5px;">
<%= work_package.status %>
@@ -46,7 +46,7 @@
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom: 10px; font-size: 14px; font-weight: bold;">
<tr>
- <td>
+ <td style="color: <%= type_color(work_package.type) %>;">
<%= work_package.type.to_s.upcase %>
</td>
<td width="100%" style="padding-left: 5px; color: #3a3a3a;">