MastoAPI: Make attachment ids strings.
This commit is contained in:
parent
1cca544e20
commit
ced0d64d75
@ -120,7 +120,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||||||
<< hash_id::signed-32, _rest::binary >> = :crypto.hash(:md5, href)
|
<< hash_id::signed-32, _rest::binary >> = :crypto.hash(:md5, href)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
id: attachment["id"] || hash_id,
|
id: to_string(attachment["id"] || hash_id),
|
||||||
url: href,
|
url: href,
|
||||||
remote_url: href,
|
remote_url: href,
|
||||||
preview_url: href,
|
preview_url: href,
|
||||||
|
@ -78,7 +78,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
|||||||
}
|
}
|
||||||
|
|
||||||
expected = %{
|
expected = %{
|
||||||
id: 1638338801,
|
id: "1638338801",
|
||||||
type: "image",
|
type: "image",
|
||||||
url: "someurl",
|
url: "someurl",
|
||||||
remote_url: "someurl",
|
remote_url: "someurl",
|
||||||
@ -90,7 +90,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
|||||||
|
|
||||||
# If theres a "id", use that instead of the generated one
|
# If theres a "id", use that instead of the generated one
|
||||||
object = Map.put(object, "id", 2)
|
object = Map.put(object, "id", 2)
|
||||||
assert %{id: 2} = StatusView.render("attachment.json", %{attachment: object})
|
assert %{id: "2"} = StatusView.render("attachment.json", %{attachment: object})
|
||||||
end
|
end
|
||||||
|
|
||||||
test "a reblog" do
|
test "a reblog" do
|
||||||
|
Loading…
Reference in New Issue
Block a user