MastoAPI: Fix repeat api bug.

Documentation was wrong, reblogging actually returns the reblog, not
the reblogged status.
This commit is contained in:
Roger Braun 2017-11-13 09:48:56 +01:00
parent 5fc6e9d467
commit 083cd169d2
2 changed files with 3 additions and 4 deletions

View File

@ -223,9 +223,8 @@ def delete_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do
end end
def reblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do def reblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do
with {:ok, _announce, %{data: %{"id" => id}}} = CommonAPI.repeat(ap_id_or_id, user), with {:ok, announce, _activity} = CommonAPI.repeat(ap_id_or_id, user) do
%Activity{} = activity <- Activity.get_create_activity_by_object_ap_id(id) do render conn, StatusView, "status.json", %{activity: announce, for: user, as: :activity}
render conn, StatusView, "status.json", %{activity: activity, for: user, as: :activity}
end end
end end

View File

@ -200,7 +200,7 @@ test "reblogs and returns the reblogged status", %{conn: conn} do
|> assign(:user, user) |> assign(:user, user)
|> post("/api/v1/statuses/#{activity.id}/reblog") |> post("/api/v1/statuses/#{activity.id}/reblog")
assert %{"id" => id, "reblogged" => true, "reblogs_count" => 1} = json_response(conn, 200) assert %{"reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 1}} = json_response(conn, 200)
assert to_string(activity.id) == id assert to_string(activity.id) == id
end end
end end