fixes #2082 proper link in mail (#2083)

* 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:
Toni Förster
2020-09-15 22:08:32 +02:00
committed by GitHub
parent ca94ac46ba
commit a27884733d
3 changed files with 7 additions and 3 deletions

View File

@ -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