From 8e6f7fdb86bc7f90618c59ee4b13b30b94fda475 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 2 Mar 2019 06:58:42 +0100 Subject: [PATCH] RelMe.maybe_put_rel_me/2: When true put "me" otherwise nil --- lib/pleroma/web/rel_me.ex | 6 +++--- test/web/rel_me_test.exs | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/rel_me.ex b/lib/pleroma/web/rel_me.ex index 3f0ee9ac6..a07db966f 100644 --- a/lib/pleroma/web/rel_me.ex +++ b/lib/pleroma/web/rel_me.ex @@ -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 diff --git a/test/web/rel_me_test.exs b/test/web/rel_me_test.exs index 94cc01728..ba8038e69 100644 --- a/test/web/rel_me_test.exs +++ b/test/web/rel_me_test.exs @@ -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