mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 16:53:49 +08:00
27 lines
618 B
Ruby
27 lines
618 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UploadSerializer < ApplicationSerializer
|
|
attributes :id,
|
|
:url,
|
|
:original_filename,
|
|
:filesize,
|
|
:width,
|
|
:height,
|
|
:thumbnail_width,
|
|
:thumbnail_height,
|
|
:extension,
|
|
:short_url,
|
|
:short_path,
|
|
:retain_hours,
|
|
:human_filesize,
|
|
:dominant_color
|
|
|
|
def url
|
|
if object.for_site_setting
|
|
object.url
|
|
else
|
|
UrlHelper.cook_url(object.url, secure: SiteSetting.secure_uploads? && object.secure)
|
|
end
|
|
end
|
|
end
|