Return target status in MastoAPI endpoint instead of reblog activity

This commit is contained in:
Francis Dinh 2018-04-16 23:30:52 -04:00
parent d16877251a
commit 42279f54cf
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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