Add some nicer urls in status view.

This commit is contained in:
lain 2019-02-20 17:36:16 +01:00
parent dff5e1e46a
commit 59c27f29c8
2 changed files with 9 additions and 2 deletions

View File

@ -144,10 +144,17 @@ def render("status.json", %{activity: %{data: %{"object" => object}} = activity}
card = render("card.json", Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)) 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), id: to_string(activity.id),
uri: object["id"], uri: object["id"],
url: object["external_url"] || object["id"], url: url,
account: AccountView.render("account.json", %{user: user}), account: AccountView.render("account.json", %{user: user}),
in_reply_to_id: reply_to && to_string(reply_to.id), 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), in_reply_to_account_id: reply_to_user && to_string(reply_to_user.id),

View File

@ -81,7 +81,7 @@ test "a note activity" do
expected = %{ expected = %{
id: to_string(note.id), id: to_string(note.id),
uri: note.data["object"]["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}), 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,