Merge branch 'webfinger-fix' into 'develop'
Use correct domain for fqn and InstanceView See merge request pleroma/pleroma!3958
This commit is contained in:
commit
40f170f0a7
|
@ -0,0 +1 @@
|
||||||
|
Use correct domain for fqn and InstanceView
|
|
@ -2252,7 +2252,7 @@ def full_nickname(%User{} = user) do
|
||||||
if String.contains?(user.nickname, "@") do
|
if String.contains?(user.nickname, "@") do
|
||||||
user.nickname
|
user.nickname
|
||||||
else
|
else
|
||||||
%{host: host} = URI.parse(user.ap_id)
|
host = Pleroma.Web.WebFinger.host()
|
||||||
user.nickname <> "@" <> host
|
user.nickname <> "@" <> host
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2683,13 +2683,23 @@ test "returns nickname without host" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "full_nickname/1" do
|
describe "full_nickname/1" do
|
||||||
test "returns fully qualified nickname for local and remote users" do
|
test "returns fully qualified nickname for local users" do
|
||||||
local_user =
|
local_user = insert(:user, nickname: "local_user")
|
||||||
insert(:user, nickname: "local_user", ap_id: "https://somehost.com/users/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)
|
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"
|
assert User.full_nickname(remote_user) == "remote@host.com"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue