Email admins when a new unapproved account is up for review
This commit is contained in:
parent
48983e9421
commit
0d004a9d04
4 changed files with 84 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
||||
use Pleroma.DataCase
|
||||
import Pleroma.Factory
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.Tests.ObanHelpers
|
||||
alias Pleroma.User
|
||||
|
|
@ -85,6 +86,42 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
)
|
||||
end
|
||||
|
||||
test "it sends an admin email if :account_approval_required is specified in instance config" do
|
||||
admin = insert(:user, is_admin: true)
|
||||
setting = Pleroma.Config.get([:instance, :account_approval_required])
|
||||
|
||||
unless setting do
|
||||
Pleroma.Config.put([:instance, :account_approval_required], true)
|
||||
on_exit(fn -> Pleroma.Config.put([:instance, :account_approval_required], setting) end)
|
||||
end
|
||||
|
||||
data = %{
|
||||
:username => "lain",
|
||||
:email => "lain@wired.jp",
|
||||
:fullname => "lain iwakura",
|
||||
:bio => "",
|
||||
:password => "bear",
|
||||
:confirm => "bear",
|
||||
:reason => "I love anime"
|
||||
}
|
||||
|
||||
{:ok, user} = TwitterAPI.register_user(data)
|
||||
ObanHelpers.perform_all()
|
||||
|
||||
assert user.approval_pending
|
||||
|
||||
email = Pleroma.Emails.AdminEmail.new_unapproved_registration(admin, user)
|
||||
|
||||
notify_email = Pleroma.Config.get([:instance, :notify_email])
|
||||
instance_name = Pleroma.Config.get([:instance, :name])
|
||||
|
||||
Swoosh.TestAssertions.assert_email_sent(
|
||||
from: {instance_name, notify_email},
|
||||
to: {admin.name, admin.email},
|
||||
html_body: email.html_body
|
||||
)
|
||||
end
|
||||
|
||||
test "it registers a new user and parses mentions in the bio" do
|
||||
data1 = %{
|
||||
:username => "john",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue