- test "the home timeline", %{user: user, conn: conn} do
- uri = "/api/v1/timelines/home?with_relationships=true"
-
- following = insert(:user, nickname: "followed")
- third_user = insert(:user, nickname: "repeated")
-
- {:ok, _activity} = CommonAPI.post(following, %{status: "post"})
- {:ok, activity} = CommonAPI.post(third_user, %{status: "repeated post"})
- {:ok, _, _} = CommonAPI.repeat(activity.id, following)
-
- ret_conn = get(conn, uri)
-
- assert Enum.empty?(json_response(ret_conn, :ok))
-
- {:ok, _user} = User.follow(user, following)
-
- ret_conn = get(conn, uri)
-
- assert [
- %{
- "reblog" => %{
- "content" => "repeated post",
- "account" => %{
- "pleroma" => %{
- "relationship" => %{"following" => false, "followed_by" => false}
- }
- }
- },
- "account" => %{"pleroma" => %{"relationship" => %{"following" => true}}}
- },
- %{
- "content" => "post",
- "account" => %{
- "acct" => "followed",
- "pleroma" => %{"relationship" => %{"following" => true}}
- }
- }
- ] = json_response(ret_conn, :ok)
-
- {:ok, _user} = User.follow(third_user, user)
-
- ret_conn = get(conn, uri)
-
- assert [
- %{
- "reblog" => %{
- "content" => "repeated post",
- "account" => %{
- "acct" => "repeated",
- "pleroma" => %{
- "relationship" => %{"following" => false, "followed_by" => true}
- }
- }
- },
- "account" => %{"pleroma" => %{"relationship" => %{"following" => true}}}
- },
- %{
- "content" => "post",
- "account" => %{
- "acct" => "followed",
- "pleroma" => %{"relationship" => %{"following" => true}}
- }
- }
- ] = json_response(ret_conn, :ok)
- end
-