From 42279f54cfa6b1728f71de0a14cfde8e615141e7 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Mon, 16 Apr 2018 23:30:52 -0400 Subject: [PATCH] Return target status in MastoAPI endpoint instead of reblog activity --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 5 +++-- test/web/mastodon_api/mastodon_api_controller_test.exs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 1825e156f..6ddfc8b75 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -297,8 +297,9 @@ def reblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do end def unreblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do - with {:ok, announce, _activity} = CommonAPI.unrepeat(ap_id_or_id, user) do - render(conn, StatusView, "status.json", %{activity: announce, for: user, as: :activity}) + with {:ok, %{data: %{"id" => id}}} = CommonAPI.unrepeat(ap_id_or_id, user), + %Activity{} = activity <- Activity.get_create_activity_by_object_ap_id(id) do + render(conn, StatusView, "status.json", %{activity: activity, for: user, as: :activity}) end end diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index f3a9c1def..2a24037d7 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -276,7 +276,7 @@ test "unreblogs and returns the unreblogged status", %{conn: conn} do |> assign(:user, user) |> post("/api/v1/statuses/#{activity.id}/unreblog") - assert %{"reblog" => %{"id" => id, "reblogged" => false, "reblogs_count" => 0}} = + assert %{"id" => id, "reblogged" => false, "reblogs_count" => 0} = json_response(conn, 200) assert to_string(activity.id) == id