Add only_reblogs parameter to account statuses API

Implement filtering to show only reblogs/reposts in user status queries.
This complements the existing exclude_reblogs parameter. Supports both
boolean and "1" string values for consistency with other API parameters.
This commit is contained in:
Lain Soykaf 2025-07-23 13:30:25 +04:00
commit 331f21111c
3 changed files with 21 additions and 0 deletions

View file

@ -469,6 +469,17 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
assert [%{"id" => ^post_id}] = json_response_and_validate_schema(conn, 200)
end
test "gets only a user's reblogs", %{user: user, conn: conn} do
{:ok, %{id: post_id}} = CommonAPI.post(user, %{status: "HI!!!"})
{:ok, %{id: reblog_id}} = CommonAPI.repeat(post_id, user)
conn = get(conn, "/api/v1/accounts/#{user.id}/statuses?only_reblogs=true")
assert [%{"id" => ^reblog_id}] = json_response_and_validate_schema(conn, 200)
conn = get(conn, "/api/v1/accounts/#{user.id}/statuses?only_reblogs=1")
assert [%{"id" => ^reblog_id}] = json_response_and_validate_schema(conn, 200)
end
test "filters user's statuses by a hashtag", %{user: user, conn: conn} do
{:ok, %{id: post_id}} = CommonAPI.post(user, %{status: "#hashtag"})
{:ok, _post} = CommonAPI.post(user, %{status: "hashtag"})