From: Haelwenn (lanodan) Monnier Date: Mon, 25 Mar 2019 23:07:33 +0000 (+0100) Subject: pagination.ex: Drop atom keys in params X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=e83ad12c5730eae7adac597b97707836122b8f7f;p=akkoma pagination.ex: Drop atom keys in params Atom keys could also have been transformed to string, or the other way around but this one is more efficient and what we actually expect with the current param_types in Pagination --- diff --git a/lib/pleroma/pagination.ex b/lib/pleroma/pagination.ex index 7c864deef..f435e5c9c 100644 --- a/lib/pleroma/pagination.ex +++ b/lib/pleroma/pagination.ex @@ -36,6 +36,12 @@ defmodule Pleroma.Pagination do limit: :integer } + params = + Enum.reduce(params, %{}, fn + {key, _value}, acc when is_atom(key) -> Map.drop(acc, [key]) + {key, value}, acc -> Map.put(acc, key, value) + end) + changeset = cast({%{}, param_types}, params, Map.keys(param_types)) changeset.changes end