2022-02-05 17:03:53 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.AdminAPI.RuleView do
|
|
|
|
use Pleroma.Web, :view
|
|
|
|
|
|
|
|
require Pleroma.Constants
|
|
|
|
|
|
|
|
def render("index.json", %{rules: rules} = _opts) do
|
|
|
|
render_many(rules, __MODULE__, "show.json")
|
|
|
|
end
|
|
|
|
|
|
|
|
def render("show.json", %{rule: rule} = _opts) do
|
|
|
|
%{
|
2022-05-30 10:30:03 +00:00
|
|
|
id: to_string(rule.id),
|
2022-02-05 17:03:53 +00:00
|
|
|
priority: rule.priority,
|
2024-04-06 08:54:59 +00:00
|
|
|
text: rule.text,
|
|
|
|
hint: rule.hint
|
2022-02-05 17:03:53 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|