From ced0d64d75831c68851d4deef9875343d9114eaa Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 15 Nov 2017 18:58:13 +0100 Subject: [PATCH] MastoAPI: Make attachment ids strings. --- lib/pleroma/web/mastodon_api/views/status_view.ex | 2 +- test/web/mastodon_api/status_view_test.exs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index d97b2acb4..38abdb35f 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -120,7 +120,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do << hash_id::signed-32, _rest::binary >> = :crypto.hash(:md5, href) %{ - id: attachment["id"] || hash_id, + id: to_string(attachment["id"] || hash_id), url: href, remote_url: href, preview_url: href, diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index 601e551a9..93c0b7236 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -78,7 +78,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do } expected = %{ - id: 1638338801, + id: "1638338801", type: "image", 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 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 test "a reblog" do -- 2.45.2