MastoAPI: Return id as string instead of integer.

This commit is contained in:
Roger Braun 2017-10-31 14:51:41 +01:00
parent f6372b245a
commit 968a546d4a
2 changed files with 6 additions and 6 deletions

View file

@ -21,9 +21,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|> Enum.map(fn (user) -> AccountView.render("mention.json", %{user: user}) end) |> Enum.map(fn (user) -> AccountView.render("mention.json", %{user: user}) end)
%{ %{
id: activity.id, id: to_string(activity.id),
uri: object, uri: object,
url: nil, url: nil, # TODO: This might be wrong, check with mastodon.
account: AccountView.render("account.json", %{user: user}), account: AccountView.render("account.json", %{user: user}),
in_reply_to_id: nil, in_reply_to_id: nil,
in_reply_to_account_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) |> Enum.map(fn {name, url} -> %{ shortcode: name, url: url, static_url: url } end)
%{ %{
id: activity.id, id: to_string(activity.id),
uri: object["id"], uri: object["id"],
url: object["external_url"] || object["id"], url: object["external_url"] || object["id"],
account: AccountView.render("account.json", %{user: user}), account: AccountView.render("account.json", %{user: user}),

View file

@ -17,7 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|> String.replace(~r/\.\d+Z/, ".000Z") |> String.replace(~r/\.\d+Z/, ".000Z")
expected = %{ expected = %{
id: note.id, id: to_string(note.id),
uri: note.data["object"]["id"], uri: note.data["object"]["id"],
url: note.data["object"]["id"], url: note.data["object"]["id"],
account: AccountView.render("account.json", %{user: user}), 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}) represented = StatusView.render("status.json", %{for: user, activity: reblog})
assert represented[:id] == reblog.id assert represented[:id] == to_string(reblog.id)
assert represented[:reblog][:id] == activity.id assert represented[:reblog][:id] == to_string(activity.id)
end end
end end