Further simplify changeset logic
authorMark Felder <feld@feld.me>
Fri, 16 Oct 2020 21:50:44 +0000 (21:50 +0000)
committerMark Felder <feld@feld.me>
Fri, 15 Jan 2021 16:42:02 +0000 (10:42 -0600)
lib/pleroma/user.ex

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