Don't embed the first page in inboxes/outboxes and refactor the views to
follow View/Controller pattern Note that I mentioned the change in 1.1 section because I intend to backport this, if this is not needed I will move it back to Unreleased.
This commit is contained in:
parent
29dd8ab9c0
commit
d87be2ec96
6 changed files with 90 additions and 88 deletions
|
|
@ -479,7 +479,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||
conn
|
||||
|> assign(:user, user)
|
||||
|> put_req_header("accept", "application/activity+json")
|
||||
|> get("/users/#{user.nickname}/inbox")
|
||||
|> get("/users/#{user.nickname}/inbox?page=true")
|
||||
|
||||
assert response(conn, 200) =~ note_object.data["content"]
|
||||
end
|
||||
|
|
@ -567,7 +567,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||
conn =
|
||||
conn
|
||||
|> put_req_header("accept", "application/activity+json")
|
||||
|> get("/users/#{user.nickname}/outbox")
|
||||
|> get("/users/#{user.nickname}/outbox?page=true")
|
||||
|
||||
assert response(conn, 200) =~ note_object.data["content"]
|
||||
end
|
||||
|
|
@ -579,7 +579,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||
conn =
|
||||
conn
|
||||
|> put_req_header("accept", "application/activity+json")
|
||||
|> get("/users/#{user.nickname}/outbox")
|
||||
|> get("/users/#{user.nickname}/outbox?page=true")
|
||||
|
||||
assert response(conn, 200) =~ announce_activity.data["object"]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
|
|||
end
|
||||
end
|
||||
|
||||
test "outbox paginates correctly" do
|
||||
test "activity collection page aginates correctly" do
|
||||
user = insert(:user)
|
||||
|
||||
posts =
|
||||
|
|
@ -171,13 +171,21 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
|
|||
# outbox sorts chronologically, newest first, with ten per page
|
||||
posts = Enum.reverse(posts)
|
||||
|
||||
%{"first" => %{"next" => next_url}} =
|
||||
UserView.render("outbox.json", %{user: user, max_id: nil})
|
||||
%{"next" => next_url} =
|
||||
UserView.render("activity_collection_page.json", %{
|
||||
iri: "#{user.ap_id}/outbox",
|
||||
activities: Enum.take(posts, 10)
|
||||
})
|
||||
|
||||
next_id = Enum.at(posts, 9).id
|
||||
assert next_url =~ next_id
|
||||
|
||||
%{"next" => next_url} = UserView.render("outbox.json", %{user: user, max_id: next_id})
|
||||
%{"next" => next_url} =
|
||||
UserView.render("activity_collection_page.json", %{
|
||||
iri: "#{user.ap_id}/outbox",
|
||||
activities: Enum.take(Enum.drop(posts, 10), 10)
|
||||
})
|
||||
|
||||
next_id = Enum.at(posts, 19).id
|
||||
assert next_url =~ next_id
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue