forked from External/greenlight
* fixes #2082 proper link in mail only send the promoted user a link to the admin page if their role allows them to. * addressed review Co-authored-by: Ahmad Farhat <ahmad.af.farhat@gmail.com>
This commit is contained in:
parent
ca94ac46ba
commit
a27884733d
|
@ -47,6 +47,10 @@ class UserMailer < ApplicationMailer
|
|||
@image = logo_image
|
||||
@color = user_color
|
||||
@role = translated_role_name(role)
|
||||
@admin_role = role.get_permission("can_manage_users") ||
|
||||
role.get_permission("can_manage_rooms_recordings") ||
|
||||
role.get_permission("can_edit_site_settings") ||
|
||||
role.get_permission("can_edit_roles")
|
||||
mail to: user.email, subject: t('mailer.user.promoted.subtitle', role: translated_role_name(role))
|
||||
end
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
<%= t('mailer.user.promoted.more-info', url: @url) %>
|
||||
</p>
|
||||
|
||||
<a style="background: <%= @color %>;color: #ffffff; padding: 10px 15px; box-shadow: 0 2px 4px 0 rgba(0,0,0,.25);border: 1px solid transparent;text-decoration:none;" href="<%= @admin_url %>">
|
||||
<%= t('mailer.user.promoted.admins_link') %>
|
||||
<a style="background: <%= @color %>;color: #ffffff; padding: 10px 15px; box-shadow: 0 2px 4px 0 rgba(0,0,0,.25);border: 1px solid transparent;text-decoration:none;" href="<%= @admin_role ? @admin_url : @url%>">
|
||||
<%= @admin_role ? t('mailer.user.promoted.admins_link') : t('mailer.user.approve.signin_link')%>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -23,4 +23,4 @@
|
|||
|
||||
<%= t('mailer.user.promoted.more-info', url: @url) %>
|
||||
|
||||
<%= @admin_url %>
|
||||
<%= @admin_role ? @admin_url : @url %>
|
||||
|
|
Loading…
Reference in New Issue