MastoAPI: Return id as string instead of integer.
authorRoger Braun <roger@rogerbraun.net>
Tue, 31 Oct 2017 13:51:41 +0000 (14:51 +0100)
committerRoger Braun <roger@rogerbraun.net>
Tue, 31 Oct 2017 13:51:41 +0000 (14:51 +0100)
lib/pleroma/web/mastodon_api/views/status_view.ex
test/web/mastodon_api/status_view_test.exs

index b3bb50880667a565f5366d11951c92db0519af99..48703e657a0b36a81ac50553fa7544f9a64320be 100644 (file)
@@ -21,9 +21,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
     |> Enum.map(fn (user) -> AccountView.render("mention.json", %{user: user}) end)
 
     %{
-      id: activity.id,
+      id: to_string(activity.id),
       uri: object,
-      url: nil,
+      url: nil, # TODO: This might be wrong, check with mastodon.
       account: AccountView.render("account.json", %{user: user}),
       in_reply_to_id: nil,
       in_reply_to_account_id: nil,
@@ -78,7 +78,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
     |> Enum.map(fn {name, url} -> %{ shortcode: name, url: url, static_url: url } end)
 
     %{
-      id: activity.id,
+      id: to_string(activity.id),
       uri: object["id"],
       url: object["external_url"] || object["id"],
       account: AccountView.render("account.json", %{user: user}),
index caa2c9d83187f3c62c1a2e606a79aabc3e83e949..5aeee98c49937ff7a18fc8fca46a59f6e43818e1 100644 (file)
@@ -17,7 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
     |> String.replace(~r/\.\d+Z/, ".000Z")
 
     expected = %{
-      id: note.id,
+      id: to_string(note.id),
       uri: note.data["object"]["id"],
       url: note.data["object"]["id"],
       account: AccountView.render("account.json", %{user: user}),
@@ -101,7 +101,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
 
     represented = StatusView.render("status.json", %{for: user, activity: reblog})
 
-    assert represented[:id] == reblog.id
-    assert represented[:reblog][:id] == activity.id
+    assert represented[:id] == to_string(reblog.id)
+    assert represented[:reblog][:id] == to_string(activity.id)
   end
 end