Only add `preferredUsername` to service actor json when the underlying user actually...
authorThibaut Girka <thib.pleroma-6b5f@sitedethib.com>
Sat, 3 Aug 2019 18:28:08 +0000 (18:28 +0000)
committerThibaut Girka <thib.pleroma-6b5f@sitedethib.com>
Sat, 3 Aug 2019 18:28:08 +0000 (18:28 +0000)
lib/pleroma/web/activity_pub/views/user_view.ex

index 4a83ac98037bd785f46f6256f7e530d8f2c9da5b..8fe38927f33eb3600035b6c6d4a6b8db8cd86e03 100644 (file)
@@ -45,7 +45,6 @@ defmodule Pleroma.Web.ActivityPub.UserView do
       "following" => "#{user.ap_id}/following",
       "followers" => "#{user.ap_id}/followers",
       "inbox" => "#{user.ap_id}/inbox",
-      "preferredUsername" => user.nickname,
       "name" => "Pleroma",
       "summary" =>
         "An internal service actor for this Pleroma instance.  No user-serviceable parts inside.",
@@ -58,6 +57,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
       },
       "endpoints" => endpoints
     }
+    |> Map.merge(if user.nickname == nil do %{} else %{ "preferredUsername" => user.nickname})
     |> Map.merge(Utils.make_json_ld_header())
   end