aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/admin_api
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-05-09 18:05:44 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-05-09 18:05:44 +0300
commit14a49a04837b0dc5a0d72dd7c5b4dfa482801e7c (patch)
tree3eb096cd798420352ecdc2f3f5ea91b01c6f6bdb /lib/pleroma/web/admin_api
parentb2924ab1fbba4e6add15030cf8444d2d3f0cfe0c (diff)
downloadpleroma-14a49a04837b0dc5a0d72dd7c5b4dfa482801e7c.tar.gz
[#2456] Dropped support for embedded `pleroma/account/relationship` in statuses and notifications.
Diffstat (limited to 'lib/pleroma/web/admin_api')
-rw-r--r--lib/pleroma/web/admin_api/views/account_view.ex9
-rw-r--r--lib/pleroma/web/admin_api/views/report_view.ex10
-rw-r--r--lib/pleroma/web/admin_api/views/status_view.ex15
3 files changed, 15 insertions, 19 deletions
diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex
index a16a3ebf0..8471b0f09 100644
--- a/lib/pleroma/web/admin_api/views/account_view.ex
+++ b/lib/pleroma/web/admin_api/views/account_view.ex
@@ -6,7 +6,9 @@ defmodule Pleroma.Web.AdminAPI.AccountView do
use Pleroma.Web, :view
alias Pleroma.User
+ alias Pleroma.Web.AdminAPI
alias Pleroma.Web.AdminAPI.AccountView
+ alias Pleroma.Web.MastodonAPI
alias Pleroma.Web.MediaProxy
def render("index.json", %{users: users, count: count, page_size: page_size}) do
@@ -119,6 +121,13 @@ defmodule Pleroma.Web.AdminAPI.AccountView do
}
end
+ def merge_account_views(%User{} = user) do
+ MastodonAPI.AccountView.render("show.json", %{user: user, skip_relationships: true})
+ |> Map.merge(AdminAPI.AccountView.render("show.json", %{user: user}))
+ end
+
+ def merge_account_views(_), do: %{}
+
defp parse_error([]), do: ""
defp parse_error(errors) do
diff --git a/lib/pleroma/web/admin_api/views/report_view.ex b/lib/pleroma/web/admin_api/views/report_view.ex
index 215e31100..f432b8c2c 100644
--- a/lib/pleroma/web/admin_api/views/report_view.ex
+++ b/lib/pleroma/web/admin_api/views/report_view.ex
@@ -10,9 +10,10 @@ defmodule Pleroma.Web.AdminAPI.ReportView do
alias Pleroma.Web.AdminAPI
alias Pleroma.Web.AdminAPI.Report
alias Pleroma.Web.CommonAPI.Utils
- alias Pleroma.Web.MastodonAPI
alias Pleroma.Web.MastodonAPI.StatusView
+ defdelegate merge_account_views(user), to: AdminAPI.AccountView
+
def render("index.json", %{reports: reports}) do
%{
reports:
@@ -71,11 +72,4 @@ defmodule Pleroma.Web.AdminAPI.ReportView do
created_at: Utils.to_masto_date(inserted_at)
}
end
-
- defp merge_account_views(%User{} = user) do
- MastodonAPI.AccountView.render("show.json", %{user: user, skip_relationships: true})
- |> Map.merge(AdminAPI.AccountView.render("show.json", %{user: user}))
- end
-
- defp merge_account_views(_), do: %{}
end
diff --git a/lib/pleroma/web/admin_api/views/status_view.ex b/lib/pleroma/web/admin_api/views/status_view.ex
index a76fad990..500800be2 100644
--- a/lib/pleroma/web/admin_api/views/status_view.ex
+++ b/lib/pleroma/web/admin_api/views/status_view.ex
@@ -7,26 +7,19 @@ defmodule Pleroma.Web.AdminAPI.StatusView do
require Pleroma.Constants
- alias Pleroma.User
alias Pleroma.Web.AdminAPI
alias Pleroma.Web.MastodonAPI
- alias Pleroma.Web.MastodonAPI.StatusView
+
+ defdelegate merge_account_views(user), to: AdminAPI.AccountView
def render("index.json", opts) do
safe_render_many(opts.activities, __MODULE__, "show.json", opts)
end
def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} = opts) do
- user = StatusView.get_user(activity.data["actor"])
+ user = MastodonAPI.StatusView.get_user(activity.data["actor"])
- StatusView.render("show.json", opts)
+ MastodonAPI.StatusView.render("show.json", opts)
|> Map.merge(%{account: merge_account_views(user)})
end
-
- defp merge_account_views(%User{} = user) do
- MastodonAPI.AccountView.render("show.json", %{user: user, skip_relationships: true})
- |> Map.merge(AdminAPI.AccountView.render("show.json", %{user: user}))
- end
-
- defp merge_account_views(_), do: %{}
end