]> cat aescling's git repositories - mastodon.git/commitdiff
Fixed WebUI crash when a status opened in the media modal is deleted (#15701)
authorkaias1jp <kaias1jp@gmail.com>
Thu, 11 Feb 2021 18:59:47 +0000 (03:59 +0900)
committerGitHub <noreply@github.com>
Thu, 11 Feb 2021 18:59:47 +0000 (19:59 +0100)
* Fixed picture in picture compatibility error in WebUI when status is deleted

* Revert "Fixed picture in picture compatibility error in WebUI when status is deleted"

This reverts commit f003b7d9d88688e9504f7dfae1545d7522fcfd98.

* Close the modal display of the image when status is deleted

* Fixed the case statement before the default statement

* Removed unnecessary parts

app/javascript/mastodon/reducers/modal.js

index a30da2db1b4ffe54409842127c03288c070e965b..cb53887c749e0c189e099b023d53ff23b67c3c46 100644 (file)
@@ -1,4 +1,5 @@
 import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modal';
+import { TIMELINE_DELETE } from '../actions/timelines';
 
 const initialState = {
   modalType: null,
@@ -11,6 +12,8 @@ export default function modal(state = initialState, action) {
     return { modalType: action.modalType, modalProps: action.modalProps };
   case MODAL_CLOSE:
     return (action.modalType === undefined || action.modalType === state.modalType) ? initialState : state;
+  case TIMELINE_DELETE:
+    return (state.modalProps.statusId === action.id) ? initialState : state;
   default:
     return state;
   }