Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85832415
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/changelog.d/cast-and-validate-cast-opts.fix b/changelog.d/cast-and-validate-cast-opts.fix
new file mode 100644
index 000000000..ba4ce2283
--- /dev/null
+++ b/changelog.d/cast-and-validate-cast-opts.fix
@@ -0,0 +1 @@
+Fix per-status and per-account rate limits when `Pleroma.Web.ApiSpec.CastAndValidate` `strict` is off (the production default)
diff --git a/lib/pleroma/web/api_spec/cast_and_validate.ex b/lib/pleroma/web/api_spec/cast_and_validate.ex
index 95bd4d9cf..92f1c5376 100644
--- a/lib/pleroma/web/api_spec/cast_and_validate.ex
+++ b/lib/pleroma/web/api_spec/cast_and_validate.ex
@@ -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}
diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
index 1b8a3b626..bc859df48 100644
--- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
@@ -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)
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Nov 2, 8:19 AM (12 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1803783
Default Alt Text
(2 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline