logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

status_view.ex (956B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.AdminAPI.StatusView do
  5. use Pleroma.Web, :view
  6. require Pleroma.Constants
  7. alias Pleroma.Web.AdminAPI
  8. alias Pleroma.Web.CommonAPI
  9. alias Pleroma.Web.MastodonAPI
  10. defdelegate merge_account_views(user), to: AdminAPI.AccountView
  11. def render("index.json", %{total: total} = opts) do
  12. %{total: total, activities: safe_render_many(opts.activities, __MODULE__, "show.json", opts)}
  13. end
  14. def render("index.json", opts) do
  15. safe_render_many(opts.activities, __MODULE__, "show.json", opts)
  16. end
  17. def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} = opts) do
  18. user = CommonAPI.get_user(activity.data["actor"])
  19. MastodonAPI.StatusView.render("show.json", opts)
  20. |> Map.merge(%{account: merge_account_views(user)})
  21. end
  22. end