logo

pleroma

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

filter_view.ex (817B)


  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.FilterView do
  5. use Pleroma.Web, :view
  6. alias Pleroma.Web.CommonAPI.Utils
  7. alias Pleroma.Web.MastodonAPI.FilterView
  8. def render("index.json", %{filters: filters}) do
  9. render_many(filters, FilterView, "show.json")
  10. end
  11. def render("show.json", %{filter: filter}) do
  12. expires_at =
  13. if filter.expires_at do
  14. Utils.to_masto_date(filter.expires_at)
  15. else
  16. nil
  17. end
  18. %{
  19. id: to_string(filter.filter_id),
  20. phrase: filter.phrase,
  21. context: filter.context,
  22. expires_at: expires_at,
  23. irreversible: filter.hide,
  24. whole_word: filter.whole_word
  25. }
  26. end
  27. end