|
|
|
@ -634,8 +634,16 @@ defmodule Pleroma.User do
|
|
|
|
|
opts[:need_confirmation]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
need_approval? =
|
|
|
|
|
if is_nil(opts[:need_approval]) do
|
|
|
|
|
Config.get([:instance, :account_approval_required])
|
|
|
|
|
else
|
|
|
|
|
opts[:need_approval]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
struct
|
|
|
|
|
|> confirmation_changeset(need_confirmation: need_confirmation?)
|
|
|
|
|
|> approval_changeset(need_approval: need_approval?)
|
|
|
|
|
|> cast(params, [
|
|
|
|
|
:bio,
|
|
|
|
|
:raw_bio,
|
|
|
|
@ -2145,6 +2153,12 @@ defmodule Pleroma.User do
|
|
|
|
|
cast(user, params, [:confirmation_pending, :confirmation_token])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@spec approval_changeset(User.t(), keyword()) :: Changeset.t()
|
|
|
|
|
def approval_changeset(user, need_approval: need_approval?) do
|
|
|
|
|
params = if need_approval?, do: %{approval_pending: true}, else: %{approval_pending: false}
|
|
|
|
|
cast(user, params, [:approval_pending])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def add_pinnned_activity(user, %Pleroma.Activity{id: id}) do
|
|
|
|
|
if id not in user.pinned_activities do
|
|
|
|
|
max_pinned_statuses = Config.get([:instance, :max_pinned_statuses], 0)
|
|
|
|
|