Federate banners out.
authorRoger Braun <roger@rogerbraun.net>
Sat, 16 Sep 2017 11:44:08 +0000 (13:44 +0200)
committerRoger Braun <roger@rogerbraun.net>
Sat, 16 Sep 2017 11:44:08 +0000 (13:44 +0200)
lib/pleroma/user.ex
lib/pleroma/web/ostatus/user_representer.ex

index 39d8cca768aeb7222b654de3d119fbf2ba409683..a04bbe276e74a0220015de1eeb2398924f085b31 100644 (file)
@@ -34,6 +34,13 @@ defmodule Pleroma.User do
     end
   end
 
+  def banner_url(user) do
+    case user.info["banner"] do
+      %{"url" => [%{"href" => href} | _]} -> href
+      _ -> nil
+    end
+  end
+
   def ap_id(%User{nickname: nickname}) do
     "#{Web.base_url}/users/#{nickname}"
   end
index 273d7524a8795fbe0c545500788e15f6c9df31ed..14f78a4ed7babea5ee50c81a09efb6c6d2258448 100644 (file)
@@ -6,6 +6,12 @@ defmodule Pleroma.Web.OStatus.UserRepresenter do
     name = to_charlist(user.name)
     bio = to_charlist(user.bio)
     avatar_url = to_charlist(User.avatar_url(user))
+    banner = if banner_url = User.banner_url(user) do
+      [{:link, [rel: 'header', href: banner_url], []}]
+    else
+      []
+    end
+
     [
       {:id, [ap_id]},
       {:"activity:object", ['http://activitystrea.ms/schema/1.0/person']},
@@ -15,6 +21,6 @@ defmodule Pleroma.Web.OStatus.UserRepresenter do
       {:"poco:note", [bio]},
       {:name, [nickname]},
       {:link, [rel: 'avatar', href: avatar_url], []}
-    ]
+    ] ++ banner
   end
 end