UX: show user email address on "grant admin access" email and UI

This commit is contained in:
Arpit Jalan 2019-11-04 14:47:00 +05:30
parent f66e5d38d3
commit b7327d2c34
5 changed files with 9 additions and 5 deletions

View File

@ -7,13 +7,15 @@ module Jobs
def execute(args)
to_address = args[:to_address]
token = args[:token]
target_email = args[:target_email]
target_username = args[:target_username]
raise Discourse::InvalidParameters.new(:to_address) if to_address.blank?
raise Discourse::InvalidParameters.new(:token) if token.blank?
raise Discourse::InvalidParameters.new(:target_email) if target_email.blank?
raise Discourse::InvalidParameters.new(:target_username) if target_username.blank?
message = AdminConfirmationMailer.send_email(to_address, target_username, token)
message = AdminConfirmationMailer.send_email(to_address, target_email, target_username, token)
Email::Sender.new(message, :admin_confirmation_message).send
end

View File

@ -3,10 +3,11 @@
class AdminConfirmationMailer < ActionMailer::Base
include Email::BuildEmailHelper
def send_email(to_address, target_username, token)
def send_email(to_address, target_email, target_username, token)
build_email(
to_address,
template: 'admin_confirmation_mailer',
target_email: target_email,
target_username: target_username,
admin_confirm_url: confirm_admin_url(token: token, host: Discourse.base_url)
)

View File

@ -3,7 +3,7 @@
<br/>
<%- unless @confirmed %>
<%=raw (t('activation.admin_confirm.description', target_username: @confirmation.target_user.username)) %>
<%=raw (t('activation.admin_confirm.description', target_email: @confirmation.target_user.email, target_username: @confirmation.target_user.username)) %>
<br/>
<br/>

View File

@ -822,7 +822,7 @@ en:
activated: "Sorry, this account has already been activated."
admin_confirm:
title: "Confirm Admin Account"
description: "Are you sure you want <b>%{target_username}</b> to be an administrator?"
description: "Are you sure you want <b>%{target_username} (%{target_email})</b> to be an administrator?"
grant: "Grant Admin Access"
complete: "<b>%{target_username}</b> is now an administrator."
back_to: "Return to %{title}"
@ -2477,7 +2477,7 @@ en:
title: "Admin Confirmation"
subject_template: "[%{email_prefix}] Confirm new Admin Account"
text_body_template: |
Please confirm that you'd like to add **%{target_username}** as an administrator for your forum.
Please confirm that you'd like to add **%{target_username} (%{target_email})** as an administrator for your forum.
[Confirm Administrator Account](%{admin_confirm_url})

View File

@ -26,6 +26,7 @@ class AdminConfirmation
Jobs.enqueue(
:admin_confirmation_email,
to_address: @performed_by.email,
target_email: @target_user.email,
target_username: @target_user.username,
token: @token
)