Merge branch 'fix/pagination-regression' into 'develop'
Do not try to guess which pagination we need by the existence of an :offset param. Closes #2399 See merge request pleroma/pleroma!3230
This commit is contained in:
commit
20a269ed69
@ -608,11 +608,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
|> Map.put(:muting_user, reading_user)
|
|> Map.put(:muting_user, reading_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
pagination_type =
|
pagination_type = Map.get(params, :pagination_type) || :keyset
|
||||||
cond do
|
|
||||||
!Map.has_key?(params, :offset) -> :keyset
|
|
||||||
true -> :offset
|
|
||||||
end
|
|
||||||
|
|
||||||
%{
|
%{
|
||||||
godmode: params[:godmode],
|
godmode: params[:godmode],
|
||||||
|
@ -110,7 +110,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
|||||||
limit: page_size,
|
limit: page_size,
|
||||||
offset: (page - 1) * page_size,
|
offset: (page - 1) * page_size,
|
||||||
godmode: godmode,
|
godmode: godmode,
|
||||||
exclude_reblogs: not with_reblogs
|
exclude_reblogs: not with_reblogs,
|
||||||
|
pagination_type: :offset
|
||||||
})
|
})
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|
@ -469,6 +469,21 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||||||
}
|
}
|
||||||
] = result
|
] = result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "paginates a user's statuses", %{user: user, conn: conn} do
|
||||||
|
{:ok, post_1} = CommonAPI.post(user, %{status: "first post"})
|
||||||
|
{:ok, post_2} = CommonAPI.post(user, %{status: "second post"})
|
||||||
|
|
||||||
|
response_1 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1")
|
||||||
|
assert [res] = json_response(response_1, 200)
|
||||||
|
assert res["id"] == post_2.id
|
||||||
|
|
||||||
|
response_2 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1&max_id=#{res["id"]}")
|
||||||
|
assert [res] = json_response(response_2, 200)
|
||||||
|
assert res["id"] == post_1.id
|
||||||
|
|
||||||
|
refute response_1 == response_2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp local_and_remote_activities(%{local: local, remote: remote}) do
|
defp local_and_remote_activities(%{local: local, remote: remote}) do
|
||||||
|
Loading…
Reference in New Issue
Block a user