Merge branch 'user-actor-webfinger' into 'develop'
FEP-2c59, add "webfinger" to user actor See merge request pleroma/pleroma!4099
This commit is contained in:
commit
d80e0d6873
|
@ -0,0 +1 @@
|
||||||
|
Implement FEP-2c59, add "webfinger" to user actor
|
|
@ -67,8 +67,13 @@ def render("service.json", %{user: user}) do
|
||||||
def render("user.json", %{user: %User{nickname: nil} = user}),
|
def render("user.json", %{user: %User{nickname: nil} = user}),
|
||||||
do: render("service.json", %{user: user})
|
do: render("service.json", %{user: user})
|
||||||
|
|
||||||
def render("user.json", %{user: %User{nickname: "internal." <> _} = user}),
|
def render("user.json", %{user: %User{nickname: "internal." <> _} = user}) do
|
||||||
do: render("service.json", %{user: user}) |> Map.put("preferredUsername", user.nickname)
|
render("service.json", %{user: user})
|
||||||
|
|> Map.merge(%{
|
||||||
|
"preferredUsername" => user.nickname,
|
||||||
|
"webfinger" => "acct:#{User.full_nickname(user)}"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
def render("user.json", %{user: user}) do
|
def render("user.json", %{user: user}) do
|
||||||
{:ok, _, public_key} = Keys.keys_from_pem(user.keys)
|
{:ok, _, public_key} = Keys.keys_from_pem(user.keys)
|
||||||
|
@ -121,7 +126,8 @@ def render("user.json", %{user: user}) do
|
||||||
"discoverable" => user.is_discoverable,
|
"discoverable" => user.is_discoverable,
|
||||||
"capabilities" => capabilities,
|
"capabilities" => capabilities,
|
||||||
"alsoKnownAs" => user.also_known_as,
|
"alsoKnownAs" => user.also_known_as,
|
||||||
"vcard:bday" => birthday
|
"vcard:bday" => birthday,
|
||||||
|
"webfinger" => "acct:#{User.full_nickname(user)}"
|
||||||
}
|
}
|
||||||
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))
|
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))
|
||||||
|> Map.merge(maybe_make_image(&User.banner_url/2, "image", user))
|
|> Map.merge(maybe_make_image(&User.banner_url/2, "image", user))
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"@context": [
|
"@context": [
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
"https://w3id.org/security/v1",
|
"https://w3id.org/security/v1",
|
||||||
|
"https://purl.archive.org/socialweb/webfinger",
|
||||||
{
|
{
|
||||||
"Emoji": "toot:Emoji",
|
"Emoji": "toot:Emoji",
|
||||||
"Hashtag": "as:Hashtag",
|
"Hashtag": "as:Hashtag",
|
||||||
|
|
|
@ -91,6 +91,13 @@ test "renders AKAs" do
|
||||||
assert %{"alsoKnownAs" => ^akas} = UserView.render("user.json", %{user: user})
|
assert %{"alsoKnownAs" => ^akas} = UserView.render("user.json", %{user: user})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "renders full nickname" do
|
||||||
|
clear_config([Pleroma.Web.WebFinger, :domain], "plemora.dev")
|
||||||
|
|
||||||
|
user = insert(:user, nickname: "user")
|
||||||
|
assert %{"webfinger" => "acct:user@plemora.dev"} = UserView.render("user.json", %{user: user})
|
||||||
|
end
|
||||||
|
|
||||||
describe "endpoints" do
|
describe "endpoints" do
|
||||||
test "local users have a usable endpoints structure" do
|
test "local users have a usable endpoints structure" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
Loading…
Reference in New Issue