Apply suggestion to lib/pleroma/web/web_finger/web_finger.ex

This commit is contained in:
lain 2020-05-05 11:17:44 +00:00
parent 6a2905ccf0
commit d201527004

View file

@ -87,17 +87,16 @@ defmodule Pleroma.Web.WebFinger do
end
defp webfinger_from_xml(doc) do
with subject <- XML.string_from_xpath("//Subject", doc),
subscribe_address <-
XML.string_from_xpath(
~s{//Link[@rel="http://ostatus.org/schema/1.0/subscribe"]/@template},
doc
),
ap_id <-
XML.string_from_xpath(
~s{//Link[@rel="self" and @type="application/activity+json"]/@href},
doc
) do
subject = XML.string_from_xpath("//Subject", doc)
subscribe_address =
~s{//Link[@rel="http://ostatus.org/schema/1.0/subscribe"]/@template}
|> XML.string_from_xpath(doc)
ap_id =
~s{//Link[@rel="self" and @type="application/activity+json"]/@href}
|> XML.string_from_xpath(doc)
data = %{
"subject" => subject,
"subscribe_address" => subscribe_address,
@ -106,7 +105,6 @@ defmodule Pleroma.Web.WebFinger do
{:ok, data}
end
end
defp webfinger_from_json(doc) do
data =