Browse Source

Add thumbnail_remote_url in MediaAttachment REST response (#14358)

* Add thumbnail_remote_url in MediaAttachment REST response

* Change thumbnail_remote_url to preview_remote_url
master
Takeshi Umeda 1 year ago
committed by GitHub
parent
commit
47931db1f5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      app/serializers/rest/media_attachment_serializer.rb

+ 5
- 1
app/serializers/rest/media_attachment_serializer.rb View 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

Loading…
Cancel
Save