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