]> cat aescling's git repositories - mastodon.git/commitdiff
Add thumbnail_remote_url in MediaAttachment REST response (#14358)
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Sun, 19 Jul 2020 17:53:31 +0000 (02:53 +0900)
committerGitHub <noreply@github.com>
Sun, 19 Jul 2020 17:53:31 +0000 (19:53 +0200)
* Add thumbnail_remote_url in MediaAttachment REST response

* Change thumbnail_remote_url to preview_remote_url

app/serializers/rest/media_attachment_serializer.rb

index e65f7acf1a9e607d5aeba71379616b7845befdc2..a24f953152f4a811b47e400341a6f37c9f33c4ea 100644 (file)
@@ -4,7 +4,7 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer
   include RoutingHelper
 
   attributes :id, :type, :url, :preview_url,
-             :remote_url, :text_url, :meta,
+             :remote_url, :preview_remote_url, :text_url, :meta,
              :description, :blurhash
 
   def id
@@ -35,6 +35,10 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer
     end
   end
 
+  def preview_remote_url
+    object.thumbnail_remote_url.presence
+  end
+
   def text_url
     object.local? ? medium_url(object) : nil
   end