Fix Relay
This commit is contained in:
parent
4ea1a61b00
commit
c6fba62666
2 changed files with 11 additions and 12 deletions
|
@ -53,9 +53,10 @@ def publish(_), do: {:error, "Not implemented"}
|
||||||
|
|
||||||
@spec list() :: {:ok, [String.t()]} | {:error, any()}
|
@spec list() :: {:ok, [String.t()]} | {:error, any()}
|
||||||
def list do
|
def list do
|
||||||
with %User{following: following} = _user <- get_actor() do
|
with %User{} = user <- get_actor() do
|
||||||
list =
|
list =
|
||||||
following
|
user
|
||||||
|
|> User.following()
|
||||||
|> Enum.map(fn entry -> URI.parse(entry).host end)
|
|> Enum.map(fn entry -> URI.parse(entry).host end)
|
||||||
|> Enum.uniq()
|
|> Enum.uniq()
|
||||||
|
|
||||||
|
|
|
@ -2572,22 +2572,20 @@ test "POST /relay", %{admin: admin} do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /relay", %{admin: admin} do
|
test "GET /relay", %{admin: admin} do
|
||||||
Pleroma.Web.ActivityPub.Relay.get_actor()
|
relay_user = Pleroma.Web.ActivityPub.Relay.get_actor()
|
||||||
|> Ecto.Changeset.change(
|
|
||||||
following: [
|
["http://mastodon.example.org/users/admin", "https://mstdn.io/users/mayuutann"]
|
||||||
"http://test-app.com/user/test1",
|
|> Enum.each(fn ap_id ->
|
||||||
"http://test-app.com/user/test1",
|
{:ok, user} = User.get_or_fetch_by_ap_id(ap_id)
|
||||||
"http://test-app-42.com/user/test1"
|
User.follow(relay_user, user)
|
||||||
]
|
end)
|
||||||
)
|
|
||||||
|> Pleroma.User.update_and_set_cache()
|
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, admin)
|
|> assign(:user, admin)
|
||||||
|> get("/api/pleroma/admin/relay")
|
|> get("/api/pleroma/admin/relay")
|
||||||
|
|
||||||
assert json_response(conn, 200)["relays"] -- ["test-app.com", "test-app-42.com"] == []
|
assert json_response(conn, 200)["relays"] -- ["mastodon.example.org", "mstdn.io"] == []
|
||||||
end
|
end
|
||||||
|
|
||||||
test "DELETE /relay", %{admin: admin} do
|
test "DELETE /relay", %{admin: admin} do
|
||||||
|
|
Loading…
Reference in a new issue