diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-06-10 16:08:31 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2021-06-24 15:19:12 +0200 |
commit | 036ec18fb3bfc31404be2c6ccc2e390c64b0b5e5 (patch) | |
tree | 94e0e90532568b6c5cb09268d8885a7f031933fb /app/javascript/flavours/glitch | |
parent | 776e00f19399875a135a64d8ad486f3578101cf9 (diff) |
Fix WebUI crash when a toot with a playing video gets deleted
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch')
-rw-r--r-- | app/javascript/flavours/glitch/actions/picture_in_picture.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/app/javascript/flavours/glitch/actions/picture_in_picture.js b/app/javascript/flavours/glitch/actions/picture_in_picture.js index 4085cb59e..33d8d57d4 100644 --- a/app/javascript/flavours/glitch/actions/picture_in_picture.js +++ b/app/javascript/flavours/glitch/actions/picture_in_picture.js @@ -22,13 +22,20 @@ export const PICTURE_IN_PICTURE_REMOVE = 'PICTURE_IN_PICTURE_REMOVE'; * @param {MediaProps} props * @return {object} */ -export const deployPictureInPicture = (statusId, accountId, playerType, props) => ({ - type: PICTURE_IN_PICTURE_DEPLOY, - statusId, - accountId, - playerType, - props, -}); +export const deployPictureInPicture = (statusId, accountId, playerType, props) => { + return (dispatch, getState) => { + // Do not open a player for a toot that does not exist + if (getState().hasIn(['statuses', statusId])) { + dispatch({ + type: PICTURE_IN_PICTURE_DEPLOY, + statusId, + accountId, + playerType, + props, + }); + } + }; +}; /* * @return {object} |