Merge pull request 'CastAndValidate: keep replace_params: false when strict is off' (#8045) from lambadalambda/pleroma:fix/cast-and-validate-cast-opts into develop

Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8045
This commit is contained in:
lain 2026-10-31 16:19:35 +00:00
commit 2f9252c858
3 changed files with 6 additions and 3 deletions

View file

@ -0,0 +1 @@
Fix per-status and per-account rate limits when `Pleroma.Web.ApiSpec.CastAndValidate` `strict` is off (the production default)

View file

@ -114,7 +114,7 @@ defmodule Pleroma.Web.ApiSpec.CastAndValidate do
false = _strict,
cast_opts
) do
case OpenApiSpex.cast_and_validate(spec, operation, conn, content_type) do
case OpenApiSpex.cast_and_validate(spec, operation, conn, content_type, cast_opts) do
{:ok, conn} ->
{:ok, conn}

View file

@ -2248,8 +2248,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
setup do: clear_config([:rate_limit, :statuses_actions], {60_000, 100})
setup do: oauth_access(["write:statuses", "write:favourites"])
for {action, undo} <- [{"favourite", "unfavourite"}, {"reblog", "unreblog"}] do
test "#{action} is limited per status, not per user", %{conn: conn} do
for {action, undo} <- [{"favourite", "unfavourite"}, {"reblog", "unreblog"}],
strict <- [true, false] do
test "#{action} is limited per status, not per user (strict: #{strict})", %{conn: conn} do
clear_config([Pleroma.Web.ApiSpec.CastAndValidate, :strict], unquote(strict))
conn = put_req_header(conn, "content-type", "application/json")
statuses = insert_list(3, :note_activity)