Skip to content

Commit ba54a09

Browse files
authored
Merge pull request #10622 from alphagov/NAV-18198-retire-preview-url-from-attachments
Retire preview_url from attachments
2 parents d100bf5 + d988b79 commit ba54a09

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

app/models/file_attachment.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def publishing_api_details_for_format
5252
file_size:,
5353
filename:,
5454
number_of_pages:,
55-
preview_url:,
5655
assets:,
5756
}
5857
end
@@ -75,10 +74,4 @@ def assets
7574
}
7675
end
7776
end
78-
79-
def preview_url
80-
return unless csv? && attachable.is_a?(Edition) && attachment_data.all_asset_variants_uploaded?
81-
82-
Plek.asset_root + "/media/#{attachment_data.id}/#{filename}/preview"
83-
end
8477
end

test/unit/app/models/file_attachment_test.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ def assert_delegated(attachment, method)
6464
assert attachment.filename_changed?
6565
end
6666

67-
test "return media preview_url if all_asset_variants_uploaded?" do
68-
attachment = create(:csv_attachment, attachable: create(:edition))
69-
assert_equal Plek.asset_root + "/media/#{attachment.attachment_data.id}/sample.csv/preview", attachment.publishing_api_details_for_format[:preview_url]
70-
end
71-
7267
test "#assets returns assets list if all_asset_variants_uploaded?" do
7368
attachment = create(:csv_attachment, attachable: create(:edition))
7469

test/unit/app/presenters/publishing_api/publication_presenter_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,6 @@ def present(edition)
289289

290290
attachments = presented_publication.content[:details][:attachments]
291291
assert_equal 1, attachments.length
292-
assert_not_nil attachments[0][:preview_url]
292+
assert_not_nil attachments[0][:assets]
293293
end
294294
end

0 commit comments

Comments
 (0)