RelMe.maybe_put_rel_me/2: When true put "me" otherwise nil
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 2 Mar 2019 05:58:42 +0000 (06:58 +0100)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 2 Mar 2019 05:58:42 +0000 (06:58 +0100)
lib/pleroma/web/rel_me.ex
test/web/rel_me_test.exs

index 3f0ee9ac64ed31cd1d2a93fcdcedca33d9fae78b..a07db966f0b53970b0c681e421bf2d6502c94534 100644 (file)
@@ -40,12 +40,12 @@ defmodule Pleroma.Web.RelMe do
 
     true = Enum.any?(rel_me_hrefs, fn x -> x in profile_urls end)
 
-    "rel=\"me\" "
+    "me"
   rescue
-    _ -> ""
+    _ -> nil
   end
 
   def maybe_put_rel_me(_, _) do
-    ""
+    nil
   end
 end
index 94cc0172894e00dddfa150ff4cf8ecce10d51391..ba8038e692b53dcccc6d75a25a66bab5e34404b5 100644 (file)
@@ -37,13 +37,14 @@ defmodule Pleroma.Web.RelMeTest do
 
   test "maybe_put_rel_me/2" do
     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) ==
-             ""
+             fallback
 
     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) ==
              attr