Merge branch 'webfinger-fix' into 'develop'

Use correct domain for fqn and InstanceView

See merge request pleroma/pleroma!3958
This commit is contained in:
tusooa 2023-12-27 17:10:32 +00:00
commit 40f170f0a7
3 changed files with 16 additions and 5 deletions

View File

@ -0,0 +1 @@
Use correct domain for fqn and InstanceView

View File

@ -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

View File

@ -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