Pleroma.Web.MastodonAPI.StatusView: Fix status.json so it renders threads
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 15 Jun 2018 19:37:29 +0000 (21:37 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 15 Jun 2018 20:14:17 +0000 (22:14 +0200)
lib/pleroma/web/mastodon_api/views/status_view.ex
test/web/mastodon_api/status_view_test.exs

index d1d48cd0aacbdd2c3a5be46abfe4e8cb7af27fc5..59898457b73aee226df473ccdbeb48961c7d155a 100644 (file)
@@ -125,8 +125,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
       uri: object["id"],
       url: object["external_url"] || object["id"],
       account: AccountView.render("account.json", %{user: user}),
-      in_reply_to_id: reply_to && reply_to.id,
-      in_reply_to_account_id: reply_to_user && reply_to_user.id,
+      in_reply_to_id: reply_to && to_string(reply_to.id),
+      in_reply_to_account_id: reply_to_user && to_string(reply_to_user.id),
       reblog: nil,
       content: HtmlSanitizeEx.basic_html(object["content"]),
       created_at: created_at,
index d9a0a8a95aed9dc34e8c46801bca42128e2242ef..d28c3cbadcbe7b2b490349793acff355510ff3b4 100644 (file)
@@ -64,11 +64,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
 
     status = StatusView.render("status.json", %{activity: activity})
 
-    assert status.in_reply_to_id == note.id
+    assert status.in_reply_to_id == to_string(note.id)
 
     [status] = StatusView.render("index.json", %{activities: [activity], as: :activity})
 
-    assert status.in_reply_to_id == note.id
+    assert status.in_reply_to_id == to_string(note.id)
   end
 
   test "contains mentions" do