New mix tasks for controlling user confirmation status and sending confirmation mails
[akkoma] / lib / pleroma / web / admin_api / views / status_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.AdminAPI.StatusView do
6 use Pleroma.Web, :view
7
8 require Pleroma.Constants
9
10 alias Pleroma.Web.AdminAPI
11 alias Pleroma.Web.MastodonAPI
12
13 defdelegate merge_account_views(user), to: AdminAPI.AccountView
14
15 def render("index.json", opts) do
16 safe_render_many(opts.activities, __MODULE__, "show.json", opts)
17 end
18
19 def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} = opts) do
20 user = MastodonAPI.StatusView.get_user(activity.data["actor"])
21
22 MastodonAPI.StatusView.render("show.json", opts)
23 |> Map.merge(%{account: merge_account_views(user)})
24 end
25 end