Merge branch 'develop' into feature/admin-api-user-statuses
authorMaxim Filippov <colixer@gmail.com>
Thu, 18 Jul 2019 20:38:38 +0000 (23:38 +0300)
committerMaxim Filippov <colixer@gmail.com>
Thu, 18 Jul 2019 20:38:38 +0000 (23:38 +0300)
1  2 
CHANGELOG.md
lib/pleroma/web/router.ex
test/web/admin_api/admin_api_controller_test.exs

diff --cc CHANGELOG.md
index 149944a02f6d21e9ee997cce8a3fc027d59c8d3f,6f268d1101ad5b2f8dbc8e7680a96420bb44c390..3a0f2cdc927467ff88671e9ded207dd84b5eb8a3
@@@ -33,9 -40,11 +40,12 @@@ The format is based on [Keep a Changelo
  - Admin API: Added support for `tuples`.
  - Added synchronization of following/followers counters for external users
  - Configuration: `enabled` option for `Pleroma.Emails.Mailer`, defaulting to `false`.
- - Mastodon API: Add support for categories for custom emojis by reusing the group feature. <https://github.com/tootsuite/mastodon/pull/11196>
  - Configuration: Pleroma.Plugs.RateLimiter `bucket_name`, `params` options.
+ - Addressable lists
+ - Twitter API: added rate limit for `/api/account/password_reset` endpoint.
+ - ActivityPub: Add an internal service actor for fetching ActivityPub objects.
+ - ActivityPub: Optional signing of ActivityPub object fetches.
 +- Admin API: Endpoint for fetching latest user's statuses
  
  ### Changed
  - Configuration: Filter.AnonymizeFilename added ability to retain file extension with custom text
Simple merge
index 9d4b3d74ba77a09bb93c42c1b1c882b851bae730,ee48b752c29e631157baa7d11803e32058d6a3cb..25e062878d59d9f542778007c92d42741aa3685d
@@@ -1862,40 -1862,46 +1862,79 @@@ defmodule Pleroma.Web.AdminAPI.AdminAPI
                 ]
               }
      end
+     test "queues key as atom", %{conn: conn} do
+       conn =
+         post(conn, "/api/pleroma/admin/config", %{
+           configs: [
+             %{
+               "group" => "pleroma_job_queue",
+               "key" => ":queues",
+               "value" => [
+                 %{"tuple" => [":federator_incoming", 50]},
+                 %{"tuple" => [":federator_outgoing", 50]},
+                 %{"tuple" => [":web_push", 50]},
+                 %{"tuple" => [":mailer", 10]},
+                 %{"tuple" => [":transmogrifier", 20]},
+                 %{"tuple" => [":scheduled_activities", 10]},
+                 %{"tuple" => [":background", 5]}
+               ]
+             }
+           ]
+         })
+       assert json_response(conn, 200) == %{
+                "configs" => [
+                  %{
+                    "group" => "pleroma_job_queue",
+                    "key" => ":queues",
+                    "value" => [
+                      %{"tuple" => [":federator_incoming", 50]},
+                      %{"tuple" => [":federator_outgoing", 50]},
+                      %{"tuple" => [":web_push", 50]},
+                      %{"tuple" => [":mailer", 10]},
+                      %{"tuple" => [":transmogrifier", 20]},
+                      %{"tuple" => [":scheduled_activities", 10]},
+                      %{"tuple" => [":background", 5]}
+                    ]
+                  }
+                ]
+              }
+     end
    end
 +
 +  describe "GET /api/pleroma/admin/users/:nickname/statuses" do
 +    setup do
 +      admin = insert(:user, info: %{is_admin: true})
 +      user = insert(:user)
 +
 +      date1 = (DateTime.to_unix(DateTime.utc_now()) + 2000) |> DateTime.from_unix!()
 +      date2 = (DateTime.to_unix(DateTime.utc_now()) + 1000) |> DateTime.from_unix!()
 +      date3 = (DateTime.to_unix(DateTime.utc_now()) + 3000) |> DateTime.from_unix!()
 +
 +      insert(:note_activity, user: user, published: date1)
 +      insert(:note_activity, user: user, published: date2)
 +      insert(:note_activity, user: user, published: date3)
 +
 +      conn =
 +        build_conn()
 +        |> assign(:user, admin)
 +
 +      {:ok, conn: conn, user: user}
 +    end
 +
 +    test "renders user's statuses", %{conn: conn, user: user} do
 +      conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses")
 +
 +      assert json_response(conn, 200) |> length() == 3
 +    end
 +
 +    test "renders user's statuses with a limit", %{conn: conn, user: user} do
 +      conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=2")
 +
 +      assert json_response(conn, 200) |> length() == 2
 +    end
 +  end
  end
  
  # Needed for testing