Pleroma.Web.PleromaAPI.ChatController: fix dialyzer errors with replace_params: false

This commit is contained in:
Mark Felder 2024-01-30 19:03:11 -05:00
commit 4d20fbc6d9
2 changed files with 52 additions and 17 deletions

View file

@ -53,10 +53,15 @@ defmodule Pleroma.Web.ControllerHelper do
end
end
# TODO: Only fetch the params from open_api_spex when everything is converted
@id_keys Pagination.page_keys() -- ["limit", "order"]
defp build_pagination_fields(conn, min_id, max_id, extra_params) do
params =
conn.params
if Map.has_key?(conn.private, :open_api_spex) do
get_in(conn, [Access.key(:private), Access.key(:open_api_spex), Access.key(:params)])
else
conn.params
end
|> Map.drop(Map.keys(conn.path_params) |> Enum.map(&String.to_existing_atom/1))
|> Map.merge(extra_params)
|> Map.drop(@id_keys)