Browse Source

Merge branch 'nicer-share-urls' into 'develop'

Add some nicer urls in status view.

See merge request pleroma/pleroma!844
tags/v1.1.4
kaniini 5 years ago
parent
commit
77fb926afa
2 changed files with 9 additions and 2 deletions
  1. +8
    -1
      lib/pleroma/web/mastodon_api/views/status_view.ex
  2. +1
    -1
      test/web/mastodon_api/status_view_test.exs

+ 8
- 1
lib/pleroma/web/mastodon_api/views/status_view.ex View File

@@ -144,10 +144,17 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do

card = render("card.json", Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity))

url =
if user.local do
Pleroma.Web.Router.Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, activity)
else
object["external_url"] || object["id"]
end

%{
id: to_string(activity.id),
uri: object["id"],
url: object["external_url"] || object["id"],
url: url,
account: AccountView.render("account.json", %{user: user}),
in_reply_to_id: reply_to && to_string(reply_to.id),
in_reply_to_account_id: reply_to_user && to_string(reply_to_user.id),


+ 1
- 1
test/web/mastodon_api/status_view_test.exs View File

@@ -81,7 +81,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
expected = %{
id: to_string(note.id),
uri: note.data["object"]["id"],
url: note.data["object"]["id"],
url: Pleroma.Web.Router.Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, note),
account: AccountView.render("account.json", %{user: user}),
in_reply_to_id: nil,
in_reply_to_account_id: nil,


Loading…
Cancel
Save