[Pleroma.Web.MastodonAPI.StatusView] Support Peertube Video titles
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 9 Aug 2018 23:19:00 +0000 (01:19 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Tue, 21 Aug 2018 16:34:56 +0000 (18:34 +0200)
lib/pleroma/web/mastodon_api/views/status_view.ex

index 7226a407e468e1e5f6fe9068503f0843055e3a81..3eca43a922ce954ade38301508fd18d8da2548ab 100644 (file)
@@ -211,6 +211,19 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
     end
   end
 
+  def render_content(%{"type" => "Video"} = object) do
+    name = object["name"]
+
+    content =
+      if !!name and name != "" do
+        "<p><a href=\"#{object["url"]}\">#{name}</a></p>#{object["content"]}"
+      else
+        object["content"]
+      end
+
+    HtmlSanitizeEx.basic_html(content)
+  end
+
   def render_content(%{"type" => "Article"} = object) do
     summary = object["name"]