MastoAPI: Always return an url for statuses.

External url if available, id if not.
This commit is contained in:
Roger Braun 2017-10-31 14:40:12 +01:00
parent f23edd2d6b
commit ce7f9f527c
2 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ def render("status.json", %{activity: %{data: %{"object" => object}} = activity}
%{ %{
id: activity.id, id: activity.id,
uri: object["id"], uri: object["id"],
url: object["external_url"], url: object["external_url"] || object["id"],
account: AccountView.render("account.json", %{user: user}), account: AccountView.render("account.json", %{user: user}),
in_reply_to_id: reply_to && reply_to.id, in_reply_to_id: reply_to && reply_to.id,
in_reply_to_account_id: reply_to_user && reply_to_user.id, in_reply_to_account_id: reply_to_user && reply_to_user.id,

View File

@ -19,7 +19,7 @@ test "a note activity" do
expected = %{ expected = %{
id: note.id, id: note.id,
uri: note.data["object"]["id"], uri: note.data["object"]["id"],
url: note.data["object"]["external_id"], url: note.data["object"]["id"],
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,