MastoAPI: Always return an url for statuses.
authorRoger Braun <roger@rogerbraun.net>
Tue, 31 Oct 2017 13:40:12 +0000 (14:40 +0100)
committerRoger Braun <roger@rogerbraun.net>
Tue, 31 Oct 2017 13:40:12 +0000 (14:40 +0100)
External url if available, id if not.

lib/pleroma/web/mastodon_api/views/status_view.ex
test/web/mastodon_api/status_view_test.exs

index 272f83b2ae6690acf9629d3b9f4a7b81400b10ef..b3bb50880667a565f5366d11951c92db0519af99 100644 (file)
@@ -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,
index dc5cdfe9aab5ddf2e35722cc61f130f5d936d98a..caa2c9d83187f3c62c1a2e606a79aabc3e83e949 100644 (file)
@@ -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,