logo

pleroma

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

suggestion_view.ex (753B)


  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.MastodonAPI.SuggestionView do
  5. use Pleroma.Web, :view
  6. alias Pleroma.Web.MastodonAPI.AccountView
  7. @source_types [:staff, :global, :past_interactions]
  8. def render("index.json", %{users: users} = opts) do
  9. Enum.map(users, fn user ->
  10. opts =
  11. opts
  12. |> Map.put(:user, user)
  13. |> Map.delete(:users)
  14. render("show.json", opts)
  15. end)
  16. end
  17. def render("show.json", %{source: source, user: _user} = opts) when source in @source_types do
  18. %{
  19. source: source,
  20. account: AccountView.render("show.json", opts)
  21. }
  22. end
  23. end