From 589eab5e3d79498f0c7e371e697759643d7f5c26 Mon Sep 17 00:00:00 2001 From: Brayan Ceron Date: Wed, 28 Aug 2024 15:50:35 -0500 Subject: [PATCH 1/2] refactor: remove thumbnail selector cause only works for edx --- .../__snapshots__/index.test.jsx.snap | 123 +----------------- .../components/ThumbnailWidget/index.jsx | 8 +- 2 files changed, 8 insertions(+), 123 deletions(-) diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/__snapshots__/index.test.jsx.snap b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/__snapshots__/index.test.jsx.snap index 87b43324f..7b15292d4 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/__snapshots__/index.test.jsx.snap @@ -1,46 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ThumbnailWidget snapshots snapshots: renders as expected where thumbnail uploads are allowed 1`] = ` - - - - - - - - - Image used as thumbnail for video - - -`; +exports[`ThumbnailWidget snapshots snapshots: renders as expected where thumbnail uploads are allowed 1`] = `null`; exports[`ThumbnailWidget snapshots snapshots: renders as expected where videoId is valid 1`] = ` `; -exports[`ThumbnailWidget snapshots snapshots: renders as expected with default props 1`] = ` - - - - - - - - -
- -
- -
-
- - -
-
-`; +exports[`ThumbnailWidget snapshots snapshots: renders as expected with default props 1`] = `null`; exports[`ThumbnailWidget snapshots snapshots: renders as expected with isLibrary true 1`] = `null`; diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/index.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/index.jsx index a0bfa4190..8bf4965ff 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/index.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/index.jsx @@ -61,7 +61,7 @@ export const ThumbnailWidget = ({ } return intl.formatMessage(messages.unavailableSubtitle); }; - return (!isLibrary ? ( + return (!isLibrary && edxVideo ? ( - {(allowThumbnailUpload && edxVideo) ? null : ( + {allowThumbnailUpload ? null : ( @@ -90,7 +90,7 @@ export const ThumbnailWidget = ({ src={thumbnailSrc || thumbnail} alt={intl.formatMessage(messages.thumbnailAltText)} /> - {(allowThumbnailUpload && edxVideo) ? ( + {allowThumbnailUpload ? ( From d124c32660189b5b1bb5de3f6afb0155faa2444f Mon Sep 17 00:00:00 2001 From: Brayan Ceron Date: Wed, 28 Aug 2024 15:51:23 -0500 Subject: [PATCH 2/2] fix: when deleting a fallback URL the app crashed --- .../VideoSettingsModal/components/VideoSourceWidget/hooks.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/hooks.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/hooks.jsx index fc3100c38..3e1cba015 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/hooks.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/hooks.jsx @@ -40,7 +40,7 @@ export const sourceHooks = ({ dispatch, previousVideoId, setAlert }) => ({ export const fallbackHooks = ({ fallbackVideos, dispatch }) => ({ addFallbackVideo: () => dispatch(actions.video.updateField({ fallbackVideos: [...fallbackVideos, ''] })), deleteFallbackVideo: (videoUrl) => { - const updatedFallbackVideos = fallbackVideos.splice(fallbackVideos.indexOf(videoUrl), 1); + const updatedFallbackVideos = fallbackVideos.toSpliced(fallbackVideos.indexOf(videoUrl), 1); dispatch(actions.video.updateField({ fallbackVideos: updatedFallbackVideos })); }, });