diff --git a/app/mailers/sharing_mailer.rb b/app/mailers/sharing_mailer.rb index a7454569dc0..917714e0cb0 100644 --- a/app/mailers/sharing_mailer.rb +++ b/app/mailers/sharing_mailer.rb @@ -32,7 +32,7 @@ class SharingMailer < ApplicationMailer include MailNotificationHelper helper :mail_notification - def shared_work_package(sharer, membership, group = nil) + def shared_work_package(sharer, membership, group = nil) # rubocop:disable Metrics/AbcSize @sharer = sharer @shared_with_user = membership.principal @invitation_token = @shared_with_user.invited? ? @shared_with_user.invitation_token : nil @@ -40,8 +40,6 @@ class SharingMailer < ApplicationMailer @work_package = membership.entity role = membership.roles.first - @role_rights = derive_role_rights(role) - @allowed_work_package_actions = derive_allowed_work_package_actions(role) @url = optionally_activated_url(work_package_url(@work_package.id), @invitation_token) @notification_url = optionally_activated_url(details_notifications_url(@work_package.id, tab: :activity), @invitation_token) @@ -49,6 +47,8 @@ class SharingMailer < ApplicationMailer message_id(membership, sharer) send_localized_mail(@shared_with_user) do + @role_rights = derive_role_rights(role) + @allowed_work_package_actions = derive_allowed_work_package_actions(role) I18n.t("mail.sharing.work_packages.subject", id: @work_package.id) end end @@ -79,14 +79,14 @@ class SharingMailer < ApplicationMailer allowed_actions = case role.builtin when Role::BUILTIN_WORK_PACKAGE_EDITOR - [I18n.t("work_package.permissions.view"), - I18n.t("work_package.permissions.comment"), - I18n.t("work_package.permissions.edit")] + [I18n.t("work_package.permissions.view_verb"), + I18n.t("work_package.permissions.comment_verb"), + I18n.t("work_package.permissions.edit_verb")] when Role::BUILTIN_WORK_PACKAGE_COMMENTER - [I18n.t("work_package.permissions.view"), - I18n.t("work_package.permissions.comment")] + [I18n.t("work_package.permissions.view_verb"), + I18n.t("work_package.permissions.comment_verb")] when Role::BUILTIN_WORK_PACKAGE_VIEWER - [I18n.t("work_package.permissions.view")] + [I18n.t("work_package.permissions.view_verb")] end allowed_actions.map(&:downcase) diff --git a/app/views/sharing_mailer/shared_work_package.html.erb b/app/views/sharing_mailer/shared_work_package.html.erb index b80954e2ba0..321813f41c0 100644 --- a/app/views/sharing_mailer/shared_work_package.html.erb +++ b/app/views/sharing_mailer/shared_work_package.html.erb @@ -36,9 +36,9 @@ <% - allowed_actions = @allowed_work_package_actions.map do |action| - content_tag(:span, action.downcase, class: "-bold") - end.to_sentence + allowed_actions = to_sentence( + @allowed_work_package_actions.map { |action| content_tag(:span, action, style: "font-weight: bold") } + ) %> <%= t("mail.sharing.work_packages.allowed_actions_html", allowed_actions:) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index df4d04f11e4..ecc2aa23f19 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4616,7 +4616,7 @@ en: note: "Note: “%{note}”" sharing: work_packages: - allowed_actions_html: "You may %{allowed_actions} this work package. This can change depending on your project role and permissions." + allowed_actions_html: "You have the following permissions on this work package: %{allowed_actions}. This can change depending on your project role and permissions." create_account: "To access this work package, you will need to create and activate an account on %{instance}." open_work_package: "Open work package" subject: "Work package #%{id} was shared with you" @@ -5970,10 +5970,13 @@ en: same_as_work: "Set to same value as Work." permissions: comment: "Comment" + comment_verb: "comment" comment_description: "Can view and comment this work package." edit: "Edit" + edit_verb: "edit" edit_description: "Can view, comment and edit this work package." view: "View" + view_verb: "view" view_description: "Can view this work package." reminders: label_remind_at: "Date"