RelMe.maybe_put_rel_me/2: When true put "me" otherwise nil
This commit is contained in:
parent
39a5bea9b7
commit
8e6f7fdb86
|
@ -40,12 +40,12 @@ def maybe_put_rel_me("http" <> _ = target_page, profile_urls) when is_list(profi
|
||||||
|
|
||||||
true = Enum.any?(rel_me_hrefs, fn x -> x in profile_urls end)
|
true = Enum.any?(rel_me_hrefs, fn x -> x in profile_urls end)
|
||||||
|
|
||||||
"rel=\"me\" "
|
"me"
|
||||||
rescue
|
rescue
|
||||||
_ -> ""
|
_ -> nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def maybe_put_rel_me(_, _) do
|
def maybe_put_rel_me(_, _) do
|
||||||
""
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,13 +37,14 @@ test "parse/1" do
|
||||||
|
|
||||||
test "maybe_put_rel_me/2" do
|
test "maybe_put_rel_me/2" do
|
||||||
profile_urls = ["https://social.example.org/users/lain"]
|
profile_urls = ["https://social.example.org/users/lain"]
|
||||||
attr = "rel=\"me\" "
|
attr = "me"
|
||||||
|
fallback = nil
|
||||||
|
|
||||||
assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/null", profile_urls) ==
|
assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/null", profile_urls) ==
|
||||||
""
|
fallback
|
||||||
|
|
||||||
assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/error", profile_urls) ==
|
assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/error", profile_urls) ==
|
||||||
""
|
fallback
|
||||||
|
|
||||||
assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/anchor", profile_urls) ==
|
assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/anchor", profile_urls) ==
|
||||||
attr
|
attr
|
||||||
|
|
Loading…
Reference in New Issue