FEATURE: Show video thumbnail in composer (#27233)

When uploading a video, the composer will now show a thumbnail image in
the composer preview instead of just the video placeholder image.

If `enable_diffhtml_preview` is enabled the video will be rendered in
the composer preview and is playable.
This commit is contained in:
Blake Erickson
2024-05-29 08:24:29 -06:00
committed by GitHub
parent 96305ec9a6
commit f292e645b9
4 changed files with 62 additions and 3 deletions

View File

@ -84,6 +84,11 @@ describe "Uploading files in the composer", type: :system do
expect(composer).to have_no_in_progress_uploads
expect(composer.preview).to have_css(".onebox-placeholder-container")
expect(page).to have_css(
'.onebox-placeholder-container[style*="background-image"]',
wait: Capybara.default_max_wait_time,
)
composer.submit
expect(find("#topic-title")).to have_content("Video upload test")
@ -95,5 +100,26 @@ describe "Uploading files in the composer", type: :system do
expect(page).to have_css(".video-placeholder-container[data-thumbnail-src]")
end
end
it "shows video player in composer" do
sign_in(current_user)
SiteSetting.enable_diffhtml_preview = true
visit "/new-topic"
expect(composer).to be_opened
topic.fill_in_composer_title("Video upload test")
file_path_1 = file_from_fixtures("small.mp4", "media").path
attach_file(file_path_1) { composer.click_toolbar_button("upload") }
expect(composer).to have_no_in_progress_uploads
expect(composer.preview).to have_css(".video-container video")
expect(page).to have_css(
".video-container video source[src]",
visible: false,
wait: Capybara.default_max_wait_time,
)
end
end
end