Merge branch 'systemd-drop-sysadmin-privilege' into 'develop'
[akkoma] / lib / pleroma / web / mastodon_api / views / status_view.ex
index f2a47f594aa182903a4ff53656150525b523de14..4d4681da828c5f41e0be47fd41f541db1c0c9f83 100644 (file)
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.Web.MastodonAPI.StatusView do
   use Pleroma.Web, :view
 
@@ -106,7 +110,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
     favorited = opts[:for] && opts[:for].ap_id in (object["likes"] || [])
 
     attachment_data = object["attachment"] || []
-    attachment_data = attachment_data ++ if object["type"] == "Video", do: [object], else: []
     attachments = render_many(attachment_data, StatusView, "attachment.json", as: :attachment)
 
     created_at = Utils.to_masto_date(object["published"])
@@ -244,8 +247,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
    {"name": "nextcloud", "url": "/tag/nextcloud"}]
 
   """
-  @spec build_tags(list(String.t())) :: list(map())
+  @spec build_tags(list(any())) :: list(map())
   def build_tags(object_tags) when is_list(object_tags) do
+    object_tags = for tag when is_binary(tag) <- object_tags, do: tag
+
     Enum.reduce(object_tags, [], fn tag, tags ->
       tags ++ [%{name: tag, url: "/tag/#{tag}"}]
     end)