add_link_headers: 2,
truthy_param?: 1,
assign_account_by_id: 2,
- with_relationships?: 1,
+ embed_relationships?: 1,
json_response: 3
]
)
|> add_if_present(params, :pleroma_settings_store, :pleroma_settings_store)
|> add_if_present(params, :default_scope, :default_scope)
+ |> add_if_present(params["source"], "privacy", :default_scope)
|> add_if_present(params, :actor_type, :actor_type)
changeset = User.update_changeset(user, user_params)
end
defp add_if_present(map, params, params_field, map_field, value_function \\ &{:ok, &1}) do
- with true <- Map.has_key?(params, params_field),
+ with true <- is_map(params),
+ true <- Map.has_key?(params, params_field),
{:ok, new_value} <- value_function.(Map.get(params, params_field)) do
Map.put(map, map_field, new_value)
else
for: for_user,
users: followers,
as: :user,
- embed_relationships: with_relationships?(params)
+ embed_relationships: embed_relationships?(params)
)
end
for: for_user,
users: followers,
as: :user,
- embed_relationships: with_relationships?(params)
+ embed_relationships: embed_relationships?(params)
)
end