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
Differentiate between normal comments and @mentioned comments
Henriette Darge4017151d2587
diff --git a/app/helpers/mail_digest_helper.rb b/app/helpers/mail_digest_helper.rbindex 428e8d94897..2ac0d975226 100644--- a/app/helpers/mail_digest_helper.rb+++ b/app/helpers/mail_digest_helper.rb@@ -49,6 +49,14 @@ module MailDigestHelpertimestamp_text(user, journal, extended_text)end+ def digest_comment_text(notification)+ if notification.journal.notes.match(/<mention.*data-type=\"user\".*>/)+ I18n.t(:'mail.digests.work_packages.mentioned').html_safe+ else+ I18n.t(:'mail.digests.work_packages.comment_added').html_safe+ end+ end+def email_image_tag(image, **options)attachments[image] = File.read(Rails.root.join("app/assets/images/#{image}"))image_tag attachments[image].url, **options@@ -64,9 +72,9 @@ module MailDigestHelpernotifications_center_url(['details', id, 'activity'])end- def type_color(type)+ def type_color(type, default_fallback)color_id = selected_color(type)- Color.find(color_id).hexcode if color_id+ color_id ? Color.find(color_id).hexcode : default_fallbackenddef status_colors(status)diff --git a/app/views/digest_mailer/work_packages.html.erb b/app/views/digest_mailer/work_packages.html.erbindex 61a71aa7d12..1397c7fa21c 100644--- a/app/views/digest_mailer/work_packages.html.erb+++ b/app/views/digest_mailer/work_packages.html.erb@@ -40,7 +40,9 @@target="_blank"><table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom: 10px; font-size: 12px;"><tr>- <td style="<%= status_colors(work_package.status) %>+ <td style="color: #333333;+ background-color: #FFFFFF;+ <%= status_colors(work_package.status) %>white-space: nowrap;padding: 0 5px;"><%= work_package.status %>@@ -52,16 +54,17 @@<td style="white-space: nowrap;padding-left: 5px;color: #878787;">- - <%= work_package.project %> -+ - <%= work_package.project %></td><td style="padding-left: 5px;color: #878787;white-space: nowrap;"><% unique_reasons = unique_reasons_of_notifications(notifications_by_work_package) %>+ <%= ' - ' unless unique_reasons.length === 1 && unique_reasons.first.nil? %><% unique_reasons.each_with_index do |reason, index| %><%= I18n.t(:"mail.digests.work_packages.reason.#{reason || :unknown}",- default: '-') %><%= ', ' unless unique_reasons.size-1 == index %>+ default: '') %><%= ', ' unless unique_reasons.size-1 == index %><% end %></td><td width="100%" style="text-align: right;">@@ -77,7 +80,7 @@</table><table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom: 10px; font-size: 14px; font-weight: bold;"><tr>- <td style="color: <%= type_color(work_package.type) %>;">+ <td style="color: <%= type_color(work_package.type, '#333333') %>;"><%= work_package.type.to_s.upcase %></td><td width="100%" style="padding-left: 5px; color: #333333;">@@ -90,7 +93,7 @@<% if notification.journal.notes.present? %><tr style="color: #878787; line-height: 20px; white-space: nowrap;"><td>- <%= I18n.t(:'mail.digests.work_packages.comment_added').html_safe %>+ <%= digest_comment_text(notification) %><%= digest_notification_timestamp_text(notification) %></td></tr>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 6794035aaf5..e9d9abd7f7f 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1976,6 +1976,7 @@ en:created: 'Created'created_at: '%{timestamp} ago by %{user} 'login_to_see_all: 'Log in to see all notifications.'+ mentioned: 'You have been <b>mentioned in a comment</b>'more_to_see_singular: 'There is 1 more work package with notifications.'more_to_see_plural: 'There are %{number} more work packages with notifications.'reason: