user1 = insert(:user)
user2 = insert(:user)
user3 = insert(:user)
+ CommonAPI.favorite(activity.id, user2)
+ {:ok, user2} = User.bookmark(user2, activity.data["object"]["id"])
{:ok, reblog_activity1, _object} = CommonAPI.repeat(activity.id, user1)
{:ok, _, _object} = CommonAPI.repeat(activity.id, user2)
assert %{
"reblog" => %{"id" => id, "reblogged" => false, "reblogs_count" => 2},
- "reblogged" => false
+ "reblogged" => false,
+ "favourited" => false,
+ "bookmarked" => false
} = json_response(conn_res, 200)
conn_res =
assert %{
"reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 2},
- "reblogged" => true
+ "reblogged" => true,
+ "favourited" => true,
+ "bookmarked" => true
} = json_response(conn_res, 200)
assert to_string(activity.id) == id
assert id == to_string(other_user.id)
end
+ test "following without reblogs" do
+ follower = insert(:user)
+ followed = insert(:user)
+ other_user = insert(:user)
+
+ conn =
+ build_conn()
+ |> assign(:user, follower)
+ |> post("/api/v1/accounts/#{followed.id}/follow?reblogs=false")
+
+ assert %{"showing_reblogs" => false} = json_response(conn, 200)
+
+ {:ok, activity} = CommonAPI.post(other_user, %{"status" => "hey"})
+ {:ok, reblog, _} = CommonAPI.repeat(activity.id, followed)
+
+ conn =
+ build_conn()
+ |> assign(:user, User.get_cached_by_id(follower.id))
+ |> get("/api/v1/timelines/home")
+
+ assert [] == json_response(conn, 200)
+
+ conn =
+ build_conn()
+ |> assign(:user, follower)
+ |> post("/api/v1/accounts/#{followed.id}/follow?reblogs=true")
+
+ assert %{"showing_reblogs" => true} = json_response(conn, 200)
+
+ conn =
+ build_conn()
+ |> assign(:user, User.get_cached_by_id(follower.id))
+ |> get("/api/v1/timelines/home")
+
+ expected_activity_id = reblog.id
+ assert [%{"id" => ^expected_activity_id}] = json_response(conn, 200)
+ end
+
test "following / unfollowing errors" do
user = insert(:user)
capture_log(fn ->
conn =
conn
- |> get("/api/v1/search", %{"q" => activity.data["object"]["id"]})
+ |> get("/api/v1/search", %{"q" => Object.normalize(activity).data["id"]})
assert results = json_response(conn, 200)
conn = get(conn, "/api/v1/instance")
assert result = json_response(conn, 200)
+ email = Pleroma.Config.get([:instance, :email])
# Note: not checking for "max_toot_chars" since it's optional
assert %{
"uri" => _,
"title" => _,
"description" => _,
"version" => _,
- "email" => _,
+ "email" => from_config_email,
"urls" => %{
"streaming_api" => _
},
"languages" => _,
"registrations" => _
} = result
+
+ assert email == from_config_email
end
test "get instance stats", %{conn: conn} do
assert %{"content" => "xD", "id" => id} = json_response(conn1, 200)
- activity = Activity.get_by_id(id)
+ activity = Activity.get_by_id_with_object(id)
- assert activity.data["object"]["inReplyTo"] == replied_to.data["object"]["id"]
+ assert Object.normalize(activity).data["inReplyTo"] == Object.normalize(replied_to).data["id"]
assert Activity.get_in_reply_to_activity(activity).id == replied_to.id
# Reblog from the third user