forked from AkkomaGang/akkoma
Send approval pending email during registration
This commit is contained in:
parent
c69b205409
commit
28005563f0
3 changed files with 29 additions and 1 deletions
|
@ -93,6 +93,19 @@ def account_confirmation_email(user) do
|
||||||
|> html_body(html_body)
|
|> html_body(html_body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def approval_pending_email(user) do
|
||||||
|
html_body = """
|
||||||
|
<h3>Awaiting Approval</h3>
|
||||||
|
<p>Your account at #{instance_name()} is being reviewed by staff. You will receive another email once your account is approved.</p>
|
||||||
|
"""
|
||||||
|
|
||||||
|
new()
|
||||||
|
|> to(recipient(user))
|
||||||
|
|> from(sender())
|
||||||
|
|> subject("Your account is awaiting approval")
|
||||||
|
|> html_body(html_body)
|
||||||
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Email used in digest email notifications
|
Email used in digest email notifications
|
||||||
Includes Mentions and New Followers data
|
Includes Mentions and New Followers data
|
||||||
|
|
|
@ -779,7 +779,11 @@ def post_register_action(%User{confirmation_pending: true} = user) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_register_action(%User{approval_pending: true} = user) do
|
def post_register_action(%User{approval_pending: true} = user) do
|
||||||
# TODO: Send approval explanation email
|
# Send approval pending email
|
||||||
|
user
|
||||||
|
|> Pleroma.Emails.UserEmail.approval_pending_email()
|
||||||
|
|> Pleroma.Emails.Mailer.deliver_async()
|
||||||
|
|
||||||
{:ok, user}
|
{:ok, user}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -45,4 +45,15 @@ test "build account confirmation email" do
|
||||||
assert email.html_body =~
|
assert email.html_body =~
|
||||||
Router.Helpers.confirm_email_url(Endpoint, :confirm_email, user.id, "conf-token")
|
Router.Helpers.confirm_email_url(Endpoint, :confirm_email, user.id, "conf-token")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "build approval pending email" do
|
||||||
|
config = Pleroma.Config.get(:instance)
|
||||||
|
user = insert(:user)
|
||||||
|
email = UserEmail.approval_pending_email(user)
|
||||||
|
|
||||||
|
assert email.from == {config[:name], config[:notify_email]}
|
||||||
|
assert email.to == [{user.name, user.email}]
|
||||||
|
assert email.subject == "Your account is awaiting approval"
|
||||||
|
assert email.html_body =~ "Awaiting Approval"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue