commit: 40f170f0a70eaf81f13bbe64964a98843a2ecaa9
parent 5f1d70736711275ac9f0c95e5ada4cb2f1a96e11
Author: tusooa <tusooa@kazv.moe>
Date: Wed, 27 Dec 2023 17:10:32 +0000
Merge branch 'webfinger-fix' into 'develop'
Use correct domain for fqn and InstanceView
See merge request pleroma/pleroma!3958
Diffstat:
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/changelog.d/local-webfinger.fix b/changelog.d/local-webfinger.fix
@@ -0,0 +1 @@
+Use correct domain for fqn and InstanceView
+\ No newline at end of file
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
@@ -2252,7 +2252,7 @@ defmodule Pleroma.User do
if String.contains?(user.nickname, "@") do
user.nickname
else
- %{host: host} = URI.parse(user.ap_id)
+ host = Pleroma.Web.WebFinger.host()
user.nickname <> "@" <> host
end
end
diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs
@@ -2683,13 +2683,23 @@ defmodule Pleroma.UserTest do
end
describe "full_nickname/1" do
- test "returns fully qualified nickname for local and remote users" do
- local_user =
- insert(:user, nickname: "local_user", ap_id: "https://somehost.com/users/local_user")
+ test "returns fully qualified nickname for local users" do
+ local_user = insert(:user, nickname: "local_user")
+ assert User.full_nickname(local_user) == "local_user@localhost"
+ end
+
+ test "returns fully qualified nickname for local users when using different domain for webfinger" do
+ clear_config([Pleroma.Web.WebFinger, :domain], "plemora.dev")
+
+ local_user = insert(:user, nickname: "local_user")
+
+ assert User.full_nickname(local_user) == "local_user@plemora.dev"
+ end
+
+ test "returns fully qualified nickname for remote users" do
remote_user = insert(:user, nickname: "remote@host.com", local: false)
- assert User.full_nickname(local_user) == "local_user@somehost.com"
assert User.full_nickname(remote_user) == "remote@host.com"
end