Merge branch 'metadata_webfinger' into develop
This commit is contained in:
commit
babb4b9a8f
3 changed files with 18 additions and 2 deletions
|
@ -55,7 +55,7 @@ defmodule Pleroma.Web.Metadata.Utils do
|
|||
def user_name_string(user) do
|
||||
"#{user.name} " <>
|
||||
if user.local do
|
||||
"(@#{user.nickname}@#{Pleroma.Web.Endpoint.host()})"
|
||||
"(@#{user.nickname}@#{Pleroma.Web.WebFinger.domain()})"
|
||||
else
|
||||
"(@#{user.nickname})"
|
||||
end
|
||||
|
|
|
@ -96,7 +96,7 @@ defmodule Pleroma.Web.WebFinger do
|
|||
|> XmlBuilder.to_doc()
|
||||
end
|
||||
|
||||
defp domain do
|
||||
def domain do
|
||||
Pleroma.Config.get([__MODULE__, :domain]) || Pleroma.Web.Endpoint.host()
|
||||
end
|
||||
|
||||
|
|
|
@ -77,4 +77,20 @@ defmodule Pleroma.Web.Metadata.UtilsTest do
|
|||
assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!"
|
||||
end
|
||||
end
|
||||
|
||||
describe "user_name_string/1" do
|
||||
test "it uses the Endpoint by default" do
|
||||
user = insert(:user)
|
||||
|
||||
assert Utils.user_name_string(user) == "#{user.name} (@#{user.nickname}@localhost)"
|
||||
end
|
||||
|
||||
test "it uses any custom WebFinger domain" do
|
||||
clear_config([Pleroma.Web.WebFinger, :domain], "example.com")
|
||||
|
||||
user = insert(:user)
|
||||
|
||||
assert Utils.user_name_string(user) == "#{user.name} (@#{user.nickname}@example.com)"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue