Merge branch 'develop' into feld-2168-media-preview-proxy
This commit is contained in:
commit
3737f38432
188 changed files with 331 additions and 373 deletions
|
|
@ -333,6 +333,46 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
|
|||
describe "list" do
|
||||
setup do: oauth_access(["read:lists"])
|
||||
|
||||
test "does not contain retoots", %{user: user, conn: conn} do
|
||||
other_user = insert(:user)
|
||||
{:ok, activity_one} = CommonAPI.post(user, %{status: "Marisa is cute."})
|
||||
{:ok, activity_two} = CommonAPI.post(other_user, %{status: "Marisa is stupid."})
|
||||
{:ok, _} = CommonAPI.repeat(activity_one.id, other_user)
|
||||
|
||||
{:ok, list} = Pleroma.List.create("name", user)
|
||||
{:ok, list} = Pleroma.List.follow(list, other_user)
|
||||
|
||||
conn = get(conn, "/api/v1/timelines/list/#{list.id}")
|
||||
|
||||
assert [%{"id" => id}] = json_response_and_validate_schema(conn, :ok)
|
||||
|
||||
assert id == to_string(activity_two.id)
|
||||
end
|
||||
|
||||
test "works with pagination", %{user: user, conn: conn} do
|
||||
other_user = insert(:user)
|
||||
{:ok, list} = Pleroma.List.create("name", user)
|
||||
{:ok, list} = Pleroma.List.follow(list, other_user)
|
||||
|
||||
Enum.each(1..30, fn i ->
|
||||
CommonAPI.post(other_user, %{status: "post number #{i}"})
|
||||
end)
|
||||
|
||||
res =
|
||||
get(conn, "/api/v1/timelines/list/#{list.id}?limit=1")
|
||||
|> json_response_and_validate_schema(:ok)
|
||||
|
||||
assert length(res) == 1
|
||||
|
||||
[first] = res
|
||||
|
||||
res =
|
||||
get(conn, "/api/v1/timelines/list/#{list.id}?max_id=#{first["id"]}&limit=30")
|
||||
|> json_response_and_validate_schema(:ok)
|
||||
|
||||
assert length(res) == 29
|
||||
end
|
||||
|
||||
test "list timeline", %{user: user, conn: conn} do
|
||||
other_user = insert(:user)
|
||||
{:ok, _activity_one} = CommonAPI.post(user, %{status: "Marisa is cute."})
|
||||
|
|
|
|||
|
|
@ -267,6 +267,21 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do
|
|||
describe "GET /api/v1/pleroma/chats" do
|
||||
setup do: oauth_access(["read:chats"])
|
||||
|
||||
test "it does not return chats with deleted users", %{conn: conn, user: user} do
|
||||
recipient = insert(:user)
|
||||
{:ok, _} = Chat.get_or_create(user.id, recipient.ap_id)
|
||||
|
||||
Pleroma.Repo.delete(recipient)
|
||||
User.invalidate_cache(recipient)
|
||||
|
||||
result =
|
||||
conn
|
||||
|> get("/api/v1/pleroma/chats")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert length(result) == 0
|
||||
end
|
||||
|
||||
test "it does not return chats with users you blocked", %{conn: conn, user: user} do
|
||||
recipient = insert(:user)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue