about summary refs log tree commit diff
path: root/app/javascript/mastodon/actions
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-07-07 11:46:33 -0500
committerStarfall <us@starfall.systems>2021-07-07 11:46:33 -0500
commitd30025d28d813999bfe98ce9cee2cda3bebf6c22 (patch)
treee2cf70344fc6426f3a2c778d3b6d3bab9e22c078 /app/javascript/mastodon/actions
parentfadb06ef6e1950a82f08673683e705943b93ba40 (diff)
parent0c2eb949fc21ceecbd99a81e5ffe75517a1e64df (diff)
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/mastodon/actions')
-rw-r--r--app/javascript/mastodon/actions/picture_in_picture.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/javascript/mastodon/actions/picture_in_picture.js b/app/javascript/mastodon/actions/picture_in_picture.js
index 4085cb59e..33d8d57d4 100644
--- a/app/javascript/mastodon/actions/picture_in_picture.js
+++ b/app/javascript/mastodon/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}