summaryrefslogtreecommitdiff
path: root/lib/pleroma/web/mastodon_api/views/status_view.ex
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2021-02-28 16:17:34 +0000
committerlain <lain@soykaf.club>2021-02-28 16:17:34 +0000
commite6a14e1cd10a52450eaf3d1ba258eac4042d82a9 (patch)
tree79c9920f4b01dc45a7292efcdaf9e97c7391a373 /lib/pleroma/web/mastodon_api/views/status_view.ex
parentd0823d7f1e95c91a53545fae9299e5bcc6eaf758 (diff)
parent0faf8dbef8f0d77fdd42b36ade4d55c42f0ccc8c (diff)
Merge branch 'feat/client_app_details' into 'develop'
Support application field See merge request pleroma/pleroma!3311
Diffstat (limited to 'lib/pleroma/web/mastodon_api/views/status_view.ex')
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 2cd6732fe..792197a4a 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -180,10 +180,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
media_attachments: reblogged[:media_attachments] || [],
mentions: mentions,
tags: reblogged[:tags] || [],
- application: %{
- name: "Web",
- website: nil
- },
+ application: build_application(activity_object.data["application"]),
language: nil,
emojis: [],
pleroma: %{
@@ -348,10 +345,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
poll: render(PollView, "show.json", object: object, for: opts[:for]),
mentions: mentions,
tags: build_tags(tags),
- application: %{
- name: "Web",
- website: nil
- },
+ application: build_application(object.data["application"]),
language: nil,
emojis: build_emojis(object.data["emoji"]),
pleroma: %{
@@ -540,4 +534,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
me: !!(current_user && current_user.ap_id in users)
}
end
+
+ @spec build_application(map() | nil) :: map() | nil
+ defp build_application(%{type: _type, name: name, url: url}), do: %{name: name, website: url}
+ defp build_application(_), do: nil
end