aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex
index f35ec3596..69f0e3846 100644
--- a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex
@@ -21,6 +21,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationController do
@doc "GET /api/v1/conversations"
def index(%{assigns: %{user: user}} = conn, params) do
+ params = stringify_pagination_params(params)
participations = Participation.for_user_with_last_activity_id(user, params)
conn
@@ -36,4 +37,20 @@ defmodule Pleroma.Web.MastodonAPI.ConversationController do
render(conn, "participation.json", participation: participation, for: user)
end
end
+
+ defp stringify_pagination_params(params) do
+ atom_keys =
+ Pleroma.Pagination.page_keys()
+ |> Enum.map(&String.to_atom(&1))
+
+ str_keys =
+ params
+ |> Map.take(atom_keys)
+ |> Enum.map(fn {key, value} -> {to_string(key), value} end)
+ |> Enum.into(%{})
+
+ params
+ |> Map.delete(atom_keys)
+ |> Map.merge(str_keys)
+ end
end