logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 961a5dd4cda7f807455001e1eb936d9c1e14c895
parent b7c625db0f8090ce11c75a19fbaee8f985b966c3
Author: marcin mikołajczak <git@mkljczk.pl>
Date:   Thu,  7 Mar 2024 13:32:50 +0100

Add test

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>

Diffstat:

Mtest/pleroma/user_test.exs22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs @@ -2953,4 +2953,26 @@ defmodule Pleroma.UserTest do assert is_binary(verified_at) end + + test "updating fields does not invalidate previously validated links" do + user = insert(:user, ap_id: "https://social.example.org/users/lain") + + user + |> User.update_and_set_cache(%{ + raw_fields: [%{"name" => "verified link", "value" => "http://example.com/rel_me/link"}] + }) + + ObanHelpers.perform_all() + + %User{fields: [%{"verified_at" => verified_at}]} = user = User.get_cached_by_id(user.id) + + user + |> User.update_and_set_cache(%{ + raw_fields: [%{"name" => "Verified link", "value" => "http://example.com/rel_me/link"}] + }) + + user = User.get_cached_by_id(user.id) + + assert [%{"verified_at" => ^verified_at}] = user.fields + end end