logo

pleroma

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

moderation_log_view.ex (750B)


  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.ModerationLogView do
  5. use Pleroma.Web, :view
  6. alias Pleroma.ModerationLog
  7. def render("index.json", %{log: log}) do
  8. %{
  9. items: render_many(log.items, __MODULE__, "show.json", as: :log_entry),
  10. total: log.count
  11. }
  12. end
  13. def render("show.json", %{log_entry: log_entry}) do
  14. time =
  15. log_entry.inserted_at
  16. |> DateTime.from_naive!("Etc/UTC")
  17. |> DateTime.to_unix()
  18. %{
  19. id: log_entry.id,
  20. data: log_entry.data,
  21. time: time,
  22. message: ModerationLog.get_log_entry_message(log_entry)
  23. }
  24. end
  25. end