Merge remote-tracking branch 'origin/develop' into mutes-blocks-pagination
authorEgor Kislitsyn <egor@kislitsyn.com>
Thu, 29 Oct 2020 11:35:42 +0000 (15:35 +0400)
committerEgor Kislitsyn <egor@kislitsyn.com>
Thu, 29 Oct 2020 11:35:42 +0000 (15:35 +0400)
1  2 
CHANGELOG.md
test/pleroma/web/mastodon_api/controllers/account_controller_test.exs

diff --combined CHANGELOG.md
index 41f0a4402c7ca010e962c1983b5f7accb841c3ce,03fe51f9db97bfde77e9e2a7774133bc295f0425..5f6e1fe8db41b449bbcbced9a924380417755b7c
@@@ -12,13 -12,15 +12,16 @@@ The format is based on [Keep a Changelo
  - Media preview proxy (requires `ffmpeg` and `ImageMagick` to be installed and media proxy to be enabled; see `:media_preview_proxy` config for more details).
  - Pleroma API: Importing the mutes users from CSV files.
  - Experimental websocket-based federation between Pleroma instances.
 +- Support pagination of blocks and mutes
+ - App metrics: ability to restrict access to specified IP whitelist.
+ - Configuration: Add `:instance, autofollowing_nicknames` setting to provide a way to make accounts automatically follow new users that register on the local Pleroma instance.
  
  ### Changed
  
  - **Breaking** Requires `libmagic` (or `file`) to guess file types.
  - **Breaking:** Pleroma Admin API: emoji packs and files routes changed.
  - **Breaking:** Sensitive/NSFW statuses no longer disable link previews.
+ - **Breaking:** App metrics endpoint (`/api/pleroma/app_metrics`) is disabled by default, check `docs/API/prometheus.md` on enabling and configuring. 
  - Search: Users are now findable by their urls.
  - Renamed `:await_up_timeout` in `:connections_pool` namespace to `:connect_timeout`, old name is deprecated.
  - Renamed `:timeout` in `pools` namespace to `:recv_timeout`, old name is deprecated.
@@@ -48,6 -50,9 +51,9 @@@ switched to a new configuration mechani
  
  - Add documented-but-missing chat pagination.
  - Allow sending out emails again.
+ - Allow sending chat messages to yourself.
+ - Fix remote users with a whitespace name.
+ - OStatus / static FE endpoints: fixed inaccessibility for anonymous users on non-federating instances, switched to handling per `:restrict_unauthenticated` setting.
  
  ## Unreleased (Patch)
  
index c86223b264fbce22456af83add7ad973360053c3,dcc0c81ece43617fdc1c6a8080587d5089401509..58ce76ab88b1e7a449973b537057c63ac6b286e4
@@@ -32,7 -32,7 +32,7 @@@ defmodule Pleroma.Web.MastodonAPI.Accou
      test "works by nickname" do
        user = insert(:user)
  
-       assert %{"id" => user_id} =
+       assert %{"id" => _user_id} =
                 build_conn()
                 |> get("/api/v1/accounts/#{user.nickname}")
                 |> json_response_and_validate_schema(200)
@@@ -43,7 -43,7 +43,7 @@@
  
        user = insert(:user, nickname: "user@example.com", local: false)
  
-       assert %{"id" => user_id} =
+       assert %{"id" => _user_id} =
                 build_conn()
                 |> get("/api/v1/accounts/#{user.nickname}")
                 |> json_response_and_validate_schema(200)
      test "returns lists to which the account belongs" do
        %{user: user, conn: conn} = oauth_access(["read:lists"])
        other_user = insert(:user)
-       assert {:ok, %Pleroma.List{id: list_id} = list} = Pleroma.List.create("Test List", user)
+       assert {:ok, %Pleroma.List{id: _list_id} = list} = Pleroma.List.create("Test List", user)
        {:ok, %{following: _following}} = Pleroma.List.follow(list, other_user)
  
-       assert [%{"id" => list_id, "title" => "Test List"}] =
+       assert [%{"id" => _list_id, "title" => "Test List"}] =
                 conn
                 |> get("/api/v1/accounts/#{other_user.id}/lists")
                 |> json_response_and_validate_schema(200)
  
    test "getting a list of mutes" do
      %{user: user, conn: conn} = oauth_access(["read:mutes"])
 -    other_user = insert(:user)
 +    %{id: id1} = other_user1 = insert(:user)
 +    %{id: id2} = other_user2 = insert(:user)
 +    %{id: id3} = other_user3 = insert(:user)
 +
 +    {:ok, _user_relationships} = User.mute(user, other_user1)
 +    {:ok, _user_relationships} = User.mute(user, other_user2)
 +    {:ok, _user_relationships} = User.mute(user, other_user3)
 +
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/mutes")
 +      |> json_response_and_validate_schema(200)
 +
 +    assert [id1, id2, id3] == Enum.map(result, & &1["id"])
 +
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/mutes?limit=1")
 +      |> json_response_and_validate_schema(200)
  
 -    {:ok, _user_relationships} = User.mute(user, other_user)
 +    assert [%{"id" => ^id1}] = result
  
 -    conn = get(conn, "/api/v1/mutes")
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/mutes?since_id=#{id1}")
 +      |> json_response_and_validate_schema(200)
 +
 +    assert [%{"id" => ^id2}, %{"id" => ^id3}] = result
 +
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/mutes?since_id=#{id1}&max_id=#{id3}")
 +      |> json_response_and_validate_schema(200)
 +
 +    assert [%{"id" => ^id2}] = result
 +
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/mutes?since_id=#{id1}&limit=1")
 +      |> json_response_and_validate_schema(200)
  
 -    other_user_id = to_string(other_user.id)
 -    assert [%{"id" => ^other_user_id}] = json_response_and_validate_schema(conn, 200)
 +    assert [%{"id" => ^id2}] = result
    end
  
    test "getting a list of blocks" do
      %{user: user, conn: conn} = oauth_access(["read:blocks"])
 -    other_user = insert(:user)
 +    %{id: id1} = other_user1 = insert(:user)
 +    %{id: id2} = other_user2 = insert(:user)
 +    %{id: id3} = other_user3 = insert(:user)
  
 -    {:ok, _user_relationship} = User.block(user, other_user)
 +    {:ok, _user_relationship} = User.block(user, other_user1)
 +    {:ok, _user_relationship} = User.block(user, other_user3)
 +    {:ok, _user_relationship} = User.block(user, other_user2)
  
 -    conn =
 +    result =
        conn
        |> assign(:user, user)
        |> get("/api/v1/blocks")
 +      |> json_response_and_validate_schema(200)
 +
 +    assert [id1, id2, id3] == Enum.map(result, & &1["id"])
 +
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/blocks?limit=1")
 +      |> json_response_and_validate_schema(200)
 +
 +    assert [%{"id" => ^id1}] = result
 +
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/blocks?since_id=#{id1}")
 +      |> json_response_and_validate_schema(200)
 +
 +    assert [%{"id" => ^id2}, %{"id" => ^id3}] = result
 +
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/blocks?since_id=#{id1}&max_id=#{id3}")
 +      |> json_response_and_validate_schema(200)
 +
 +    assert [%{"id" => ^id2}] = result
 +
 +    result =
 +      conn
 +      |> assign(:user, user)
 +      |> get("/api/v1/blocks?since_id=#{id1}&limit=1")
 +      |> json_response_and_validate_schema(200)
  
 -    other_user_id = to_string(other_user.id)
 -    assert [%{"id" => ^other_user_id}] = json_response_and_validate_schema(conn, 200)
 +    assert [%{"id" => ^id2}] = result
    end
  end