From d4904b392a468797d3d0c08d1ac34e2904dc801f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 2 Dec 2022 17:41:38 +0100 Subject: [PATCH] Actually fix verified_at MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- lib/pleroma/user.ex | 5 +++-- .../web/mastodon_api/controllers/account_controller.ex | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 91dd9eeec7..3479232252 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -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) diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index f54e0589e0..11ed75bda8 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -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}