From bf55d07580d41532416e77f4be54300f3a5ee1a8 Mon Sep 17 00:00:00 2001 From: Dennis Schubert Date: Tue, 4 Feb 2020 14:38:49 +0100 Subject: [PATCH] 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. --- app/presenters/photo_presenter.rb | 6 ++++-- lib/schemas/api_v1.json | 3 ++- spec/presenters/photo_presenter_spec.rb | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/presenters/photo_presenter.rb b/app/presenters/photo_presenter.rb index 2d2659400..0fa7e9a87 100644 --- a/app/presenters/photo_presenter.rb +++ b/app/presenters/photo_presenter.rb @@ -12,7 +12,8 @@ class PhotoPresenter < BasePresenter sizes: { small: url(:thumb_small), medium: url(:thumb_medium), - large: url(:scaled_full) + large: url(:scaled_full), + raw: url } } end @@ -26,7 +27,8 @@ class PhotoPresenter < BasePresenter sizes: { small: url(:thumb_small), medium: url(:thumb_medium), - large: url(:scaled_full) + large: url(:scaled_full), + raw: url } } diff --git a/lib/schemas/api_v1.json b/lib/schemas/api_v1.json index 46342dd48..a8c383417 100644 --- a/lib/schemas/api_v1.json +++ b/lib/schemas/api_v1.json @@ -205,11 +205,12 @@ "photo_sizes": { "type": "object", "properties": { + "raw": { "$ref": "https://diaspora.software/api/v1/schema.json#/definitions/url" }, "large": { "$ref": "https://diaspora.software/api/v1/schema.json#/definitions/url" }, "medium": { "$ref": "https://diaspora.software/api/v1/schema.json#/definitions/url" }, "small": { "$ref": "https://diaspora.software/api/v1/schema.json#/definitions/url" } }, - "required": ["large", "medium", "small"], + "required": ["raw", "large", "medium", "small"], "additionalProperties": true }, diff --git a/spec/presenters/photo_presenter_spec.rb b/spec/presenters/photo_presenter_spec.rb index e5bcb5677..840a8ed71 100644 --- a/spec/presenters/photo_presenter_spec.rb +++ b/spec/presenters/photo_presenter_spec.rb @@ -34,6 +34,7 @@ describe PhotoPresenter do expect(photo[:sizes][:small]).to be_truthy expect(photo[:sizes][:medium]).to be_truthy expect(photo[:sizes][:large]).to be_truthy + expect(photo[:sizes][:raw]).to be_truthy end # rubocop:enable Metrics/AbcSize end