Conversation: Return full status object, id is a string.
authorlain <lain@soykaf.club>
Mon, 15 Apr 2019 19:58:58 +0000 (21:58 +0200)
committerlain <lain@soykaf.club>
Mon, 15 Apr 2019 19:58:58 +0000 (21:58 +0200)
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
test/web/mastodon_api/mastodon_api_controller_test.exs

index 57f73dacd4078a3c1ece36185a8f3c6a4858b9e5..3ffb767b912faa2849a1c933fdfb65efff51a57c 100644 (file)
@@ -1590,12 +1590,16 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
 
     conversations =
       Enum.map(participations, fn participation ->
+        activity = Activity.get_by_id_with_object(participation.last_activity_id)
+
+        last_status = StatusView.render("status.json", %{activity: activity, for: user})
+
         %{
-          id: participation.id,
+          id: participation.id |> to_string(),
           # TODO: Add this.
           accounts: [],
           unread: !participation.read,
-          last_status: participation.last_activity_id
+          last_status: last_status
         }
       end)
 
index d1d22edde5e47f3a9f5a24acf841d958e5ed42f6..bd13f870c5a85f773ac2fada7db0946f38093588 100644 (file)
@@ -334,8 +334,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
              }
            ] = response
 
+    assert is_binary(res_id)
     assert unread == true
-    assert res_last_status == direct.id
+    assert res_last_status["id"] == direct.id
 
     # Apparently undocumented API endpoint
     res_conn =
@@ -350,7 +351,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     res_conn =
       conn
       |> assign(:user, user_one)
-      |> get("/api/v1/statuses/#{res_last_status}/context")
+      |> get("/api/v1/statuses/#{res_last_status["id"]}/context")
 
     assert %{"ancestors" => [], "descendants" => []} == json_response(res_conn, 200)
   end