logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: a361b84fc97041f69c890f09de9227f51ac905f4
parent f38e9228ef01ee575224faef72c820525dd73c22
Author: Ekaterina Vaartis <vaartis@kotobank.ch>
Date:   Wed, 11 Jun 2025 23:02:42 +0300

Relax alsoKnownAs requirements to just being a URI

Diffstat:

Achangelog.d/relax-also-known-as.change2++
Mlib/pleroma/user.ex2+-
Mlib/pleroma/web/mastodon_api/controllers/search_controller.ex2+-
Mtest/pleroma/user_test.exs9+++++++++
4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/changelog.d/relax-also-known-as.change b/changelog.d/relax-also-known-as.change @@ -0,0 +1 @@ +Relax alsoKnownAs requirements to just URI, not necessarily HTTP(S) +\ No newline at end of file diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex @@ -150,7 +150,7 @@ defmodule Pleroma.User do field(:allow_following_move, :boolean, default: true) field(:skip_thread_containment, :boolean, default: false) field(:actor_type, :string, default: "Person") - field(:also_known_as, {:array, ObjectValidators.ObjectID}, default: []) + field(:also_known_as, {:array, ObjectValidators.BareUri}, default: []) field(:inbox, :string) field(:shared_inbox, :string) field(:accepts_chat_messages, :boolean, default: nil) diff --git a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex @@ -190,7 +190,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do f.() rescue error -> - Logger.error("#{__MODULE__} search error: #{inspect(error)}") + Logger.error(Exception.format(:error, error, __STACKTRACE__)) fallback end end diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs @@ -2792,6 +2792,15 @@ defmodule Pleroma.UserTest do assert user_updated.also_known_as |> length() == 1 assert user2.ap_id in user_updated.also_known_as end + + test "should tolerate non-http(s) aliases" do + user = + insert(:user, %{ + also_known_as: ["at://did:plc:xgvzy7ni6ig6ievcbls5jaxe"] + }) + + assert "at://did:plc:xgvzy7ni6ig6ievcbls5jaxe" in user.also_known_as + end end describe "alias_users/1" do