Replace User.toggle_confirmation/1 with User.confirm/1, fixes #2235

This commit is contained in:
Alex Gleason 2020-10-13 21:52:06 -05:00
commit dc38dc8472
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
7 changed files with 13 additions and 42 deletions

View file

@ -2113,18 +2113,6 @@ defmodule Pleroma.User do
updated_user
end
@spec toggle_confirmation(User.t()) :: {:ok, User.t()} | {:error, Changeset.t()}
def toggle_confirmation(%User{} = user) do
user
|> confirmation_changeset(need_confirmation: !user.confirmation_pending)
|> update_and_set_cache()
end
@spec toggle_confirmation([User.t()]) :: [{:ok, User.t()} | {:error, Changeset.t()}]
def toggle_confirmation(users) do
Enum.map(users, &toggle_confirmation/1)
end
@spec need_confirmation(User.t(), boolean()) :: {:ok, User.t()} | {:error, Changeset.t()}
def need_confirmation(%User{} = user, bool) do
user