From 83f27282ba5c40c69cf7945e724685166bb3e5d4 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 4 Jan 2021 10:13:17 -0600 Subject: [PATCH] Do not try to guess which pagination we need by the existence of an :offset param. Require explicit request to get offset pagination. --- lib/pleroma/web/activity_pub/activity_pub.ex | 6 +----- lib/pleroma/web/admin_api/controllers/admin_api_controller.ex | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 15f298bb8..9db72d6b2 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -603,11 +603,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do |> Map.put(:muting_user, reading_user) end - pagination_type = - cond do - !Map.has_key?(params, :offset) -> :keyset - true -> :offset - end + pagination_type = Map.get(params, :pagination_type) || :keyset %{ godmode: params[:godmode], diff --git a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex index 6ef8d6061..1c7c26d98 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -110,7 +110,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do limit: page_size, offset: (page - 1) * page_size, godmode: godmode, - exclude_reblogs: not with_reblogs + exclude_reblogs: not with_reblogs, + pagination_type: :offset }) conn