aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/description.exs5
-rw-r--r--lib/pleroma/web/mastodon_api/controllers/account_controller.ex4
-rw-r--r--priv/gettext/config_descriptions.pot24
-rw-r--r--test/pleroma/web/mastodon_api/controllers/account_controller_test.exs44
4 files changed, 65 insertions, 12 deletions
diff --git a/config/description.exs b/config/description.exs
index b29348edf..c6c6b1b5d 100644
--- a/config/description.exs
+++ b/config/description.exs
@@ -1730,6 +1730,11 @@ config :pleroma, :config_description, [
description: "Sign object fetches with HTTP signatures"
},
%{
+ key: :authorized_fetch_mode,
+ type: :boolean,
+ description: "Require HTTP signatures for AP fetches"
+ },
+ %{
key: :note_replies_output_limit,
type: :integer,
description:
diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
index eb59a0a96..2aeb339f0 100644
--- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
@@ -491,7 +491,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
users =
user
|> User.muted_users_relation(_restrict_deactivated = true)
- |> Pleroma.Pagination.fetch_paginated(Map.put(params, :skip_order, true))
+ |> Pleroma.Pagination.fetch_paginated(params)
conn
|> add_link_headers(users)
@@ -509,7 +509,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
users =
user
|> User.blocked_users_relation(_restrict_deactivated = true)
- |> Pleroma.Pagination.fetch_paginated(Map.put(params, :skip_order, true))
+ |> Pleroma.Pagination.fetch_paginated(params)
conn
|> add_link_headers(users)
diff --git a/priv/gettext/config_descriptions.pot b/priv/gettext/config_descriptions.pot
index 2987f95fe..9021fbfab 100644
--- a/priv/gettext/config_descriptions.pot
+++ b/priv/gettext/config_descriptions.pot
@@ -5997,3 +5997,27 @@ msgstr ""
msgctxt "config label at :web_push_encryption-:vapid_details > :subject"
msgid "Subject"
msgstr ""
+
+#, elixir-autogen, elixir-format
+#: lib/pleroma/docs/translator.ex:5
+msgctxt "config description at :pleroma-:activitypub > :authorized_fetch_mode"
+msgid "Require HTTP signatures for AP fetches"
+msgstr ""
+
+#, elixir-autogen, elixir-format
+#: lib/pleroma/docs/translator.ex:5
+msgctxt "config description at :pleroma-:instance > :short_description"
+msgid "Shorter version of instance description. It can be seen on `/api/v1/instance`"
+msgstr ""
+
+#, elixir-autogen, elixir-format
+#: lib/pleroma/docs/translator.ex:5
+msgctxt "config label at :pleroma-:activitypub > :authorized_fetch_mode"
+msgid "Authorized fetch mode"
+msgstr ""
+
+#, elixir-autogen, elixir-format
+#: lib/pleroma/docs/translator.ex:5
+msgctxt "config label at :pleroma-:instance > :short_description"
+msgid "Short description"
+msgstr ""
diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
index effa2144f..ee9db4288 100644
--- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
@@ -1829,21 +1829,21 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|> get("/api/v1/mutes")
|> json_response_and_validate_schema(200)
- assert [id1, id2, id3] == Enum.map(result, & &1["id"])
+ assert [id3, id2, id1] == Enum.map(result, & &1["id"])
result =
conn
|> get("/api/v1/mutes?limit=1")
|> json_response_and_validate_schema(200)
- assert [%{"id" => ^id1}] = result
+ assert [%{"id" => ^id3}] = result
result =
conn
|> get("/api/v1/mutes?since_id=#{id1}")
|> json_response_and_validate_schema(200)
- assert [%{"id" => ^id2}, %{"id" => ^id3}] = result
+ assert [%{"id" => ^id3}, %{"id" => ^id2}] = result
result =
conn
@@ -1857,7 +1857,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|> get("/api/v1/mutes?since_id=#{id1}&limit=1")
|> json_response_and_validate_schema(200)
- assert [%{"id" => ^id2}] = result
+ assert [%{"id" => ^id3}] = result
end
test "list of mutes with with_relationships parameter" do
@@ -1876,7 +1876,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
assert [
%{
- "id" => ^id1,
+ "id" => ^id3,
"pleroma" => %{"relationship" => %{"muting" => true, "followed_by" => true}}
},
%{
@@ -1884,7 +1884,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
"pleroma" => %{"relationship" => %{"muting" => true, "followed_by" => true}}
},
%{
- "id" => ^id3,
+ "id" => ^id1,
"pleroma" => %{"relationship" => %{"muting" => true, "followed_by" => true}}
}
] =
@@ -1909,7 +1909,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|> get("/api/v1/blocks")
|> json_response_and_validate_schema(200)
- assert [id1, id2, id3] == Enum.map(result, & &1["id"])
+ assert [id3, id2, id1] == Enum.map(result, & &1["id"])
result =
conn
@@ -1917,7 +1917,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|> get("/api/v1/blocks?limit=1")
|> json_response_and_validate_schema(200)
- assert [%{"id" => ^id1}] = result
+ assert [%{"id" => ^id3}] = result
result =
conn
@@ -1925,7 +1925,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|> get("/api/v1/blocks?since_id=#{id1}")
|> json_response_and_validate_schema(200)
- assert [%{"id" => ^id2}, %{"id" => ^id3}] = result
+ assert [%{"id" => ^id3}, %{"id" => ^id2}] = result
result =
conn
@@ -1941,7 +1941,31 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|> get("/api/v1/blocks?since_id=#{id1}&limit=1")
|> json_response_and_validate_schema(200)
- assert [%{"id" => ^id2}] = result
+ assert [%{"id" => ^id3}] = result
+
+ conn_res =
+ conn
+ |> assign(:user, user)
+ |> get("/api/v1/blocks?limit=2")
+
+ next_url =
+ ~r{<.+?(?<link>/api[^>]+)>; rel=\"next\"}
+ |> Regex.named_captures(get_resp_header(conn_res, "link") |> Enum.at(0))
+ |> Map.get("link")
+
+ result =
+ conn_res
+ |> json_response_and_validate_schema(200)
+
+ assert [%{"id" => ^id3}, %{"id" => ^id2}] = result
+
+ result =
+ conn
+ |> assign(:user, user)
+ |> get(next_url)
+ |> json_response_and_validate_schema(200)
+
+ assert [%{"id" => ^id1}] = result
end
test "account lookup", %{conn: conn} do