From: Roger Braun Date: Tue, 31 Oct 2017 13:40:12 +0000 (+0100) Subject: MastoAPI: Always return an url for statuses. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=ce7f9f527c55b282a56c86a68c358a6272d01aee;p=akkoma MastoAPI: Always return an url for statuses. External url if available, id if not. --- diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 272f83b2a..b3bb50880 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -80,7 +80,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do %{ id: activity.id, uri: object["id"], - url: object["external_url"], + 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, diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index dc5cdfe9a..caa2c9d83 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -19,7 +19,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do expected = %{ id: note.id, uri: note.data["object"]["id"], - url: note.data["object"]["external_id"], + url: note.data["object"]["id"], account: AccountView.render("account.json", %{user: user}), in_reply_to_id: nil, in_reply_to_account_id: nil,