Further simplify changeset logic

This commit is contained in:
Mark Felder 2020-10-16 21:50:44 +00:00
parent f7e59c28ed
commit 63923df0a5

View file

@ -2328,8 +2328,7 @@ def confirmation_changeset(user, need_confirmation: need_confirmation?) do
@spec approval_changeset(User.t(), keyword()) :: Changeset.t() @spec approval_changeset(User.t(), keyword()) :: Changeset.t()
def approval_changeset(user, set_approval: approved?) do def approval_changeset(user, set_approval: approved?) do
params = if approved?, do: %{is_approved: true}, else: %{is_approved: false} cast(user, %{is_approved: approved?}, [:is_approved])
cast(user, params, [:is_approved])
end end
def add_pinnned_activity(user, %Pleroma.Activity{id: id}) do def add_pinnned_activity(user, %Pleroma.Activity{id: id}) do