Actually fix verified_at

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-12-02 17:41:38 +01:00
parent 0ab061f375
commit d4904b392a
2 changed files with 6 additions and 3 deletions

View file

@ -2713,10 +2713,11 @@ def sanitize_html(%User{} = user) do
# - display name
def sanitize_html(%User{} = user, filter) do
fields =
Enum.map(user.fields, fn %{"name" => name, "value" => value} ->
Enum.map(user.fields, fn %{"name" => name, "value" => value} = field ->
%{
"name" => name,
"value" => HTML.filter_tags(value, Pleroma.HTML.Scrubber.LinksOnly)
"value" => HTML.filter_tags(value, Pleroma.HTML.Scrubber.LinksOnly),
"verified_at" => Map.get(field, "verified_at")
}
end)

View file

@ -259,7 +259,9 @@ def update_credentials(%{assigns: %{user: user}, body_params: params} = conn, _p
defp normalize_fields_attributes(fields) do
if Enum.all?(fields, &is_tuple/1) do
Enum.map(fields, fn {_, v} -> v end)
Enum.map(fields, fn {_, %{} = field} ->
%{"name" => field["name"], "value" => field["value"]}
end)
else
Enum.map(fields, fn
%{} = field -> %{"name" => field.name, "value" => field.value}