diaspora/app/presenters/photo_presenter.rb
Dennis Schubert bf55d07580
Re-add sizes.raw to the photo JSON
because we need it for showing the raw image in the lightbox. This got lost, as the photo extension was made after API development started.
2020-02-04 14:38:49 +01:00

40 lines
839 B
Ruby

# frozen_string_literal: true
class PhotoPresenter < BasePresenter
def base_hash
{
id: id,
guid: guid,
dimensions: {
height: height,
width: width
},
sizes: {
small: url(:thumb_small),
medium: url(:thumb_medium),
large: url(:scaled_full),
raw: url
}
}
end
def as_api_json(full=false)
api_json = {
dimensions: {
height: height,
width: width
},
sizes: {
small: url(:thumb_small),
medium: url(:thumb_medium),
large: url(:scaled_full),
raw: url
}
}
api_json[:guid] = guid if full
api_json[:created_at] = created_at if full
api_json[:post] = status_message_guid if full && status_message_guid
api_json
end
end