aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/pagination.ex
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2019-03-26 00:07:33 +0100
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2019-03-28 17:18:59 +0100
commite83ad12c5730eae7adac597b97707836122b8f7f (patch)
treeaf2257ef3252c98175e1f0f539cc9ade85a9213e /lib/pleroma/pagination.ex
parent6f152240538e1b300446f3bad50977cca7203f70 (diff)
downloadpleroma-e83ad12c5730eae7adac597b97707836122b8f7f.tar.gz
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
Diffstat (limited to 'lib/pleroma/pagination.ex')
-rw-r--r--lib/pleroma/pagination.ex6
1 files changed, 6 insertions, 0 deletions
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