diff options
author | Alex Gleason <alex@alexgleason.me> | 2020-07-14 20:31:20 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2020-07-14 20:31:20 -0500 |
commit | 0d004a9d046f279be8462e8c751b5f1bcec3d35b (patch) | |
tree | 826e86f010c4ef81310166605ad83853cbce6f92 /lib/pleroma/web | |
parent | 48983e942139a81106416cfbb8d22743b6764053 (diff) | |
download | pleroma-0d004a9d046f279be8462e8c751b5f1bcec3d35b.tar.gz |
Email admins when a new unapproved account is up for review
Diffstat (limited to 'lib/pleroma/web')
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api.ex | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index 4ff021b82..2294d9d0d 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -45,6 +45,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do case User.register(changeset) do {:ok, user} -> + maybe_notify_admins(user) {:ok, user} {:error, changeset} -> @@ -57,6 +58,18 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do end end + defp maybe_notify_admins(%User{} = account) do + if Pleroma.Config.get([:instance, :account_approval_required]) do + User.all_superusers() + |> Enum.filter(fn user -> not is_nil(user.email) end) + |> Enum.each(fn superuser -> + superuser + |> Pleroma.Emails.AdminEmail.new_unapproved_registration(account) + |> Pleroma.Emails.Mailer.deliver_async() + end) + end + end + def password_reset(nickname_or_email) do with true <- is_binary(nickname_or_email), %User{local: true, email: email} = user when is_binary(email) <- |