Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix manifest generation for playlist item with deleted source #5441

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ GIT

GIT
remote: https://github.com/samvera-labs/iiif_manifest.git
revision: c8ca0c6e54517446419c20221260eaf3dcf46d4e
revision: c7467b4ae32934f161bd2cabdd741ec9293cefe6
branch: main
specs:
iiif_manifest (1.3.1)
Expand Down
2 changes: 2 additions & 0 deletions app/models/iiif_playlist_canvas_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ def master_file
end

def part_of
return if master_file.nil?
[{
"@id" => Rails.application.routes.url_helpers.manifest_media_object_url(master_file.media_object_id).to_s,
"type" => "manifest"
}]
end

def item_metadata
return if master_file.nil?
[
metadata_field('Title', master_file.media_object.title),
metadata_field('Date', master_file.media_object.date_issued),
Expand Down
12 changes: 12 additions & 0 deletions spec/controllers/playlists_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -618,5 +618,17 @@
expect(parsed_response['items'][1]['items'][0].keys).to_not include 'items'
end
end

context "playlist item with deleted source" do
before do
master_file.delete
end

it "returns a blank canvas" do
get :manifest, format: 'json', params: { id: playlist.id }, session: valid_session
parsed_response = JSON.parse(response.body)
expect(parsed_response['items'][0]['items'][0].keys).to_not include 'items'
end
end
end
end