diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-07-13 15:45:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 15:45:17 +0200 |
commit | d3791cca0cd862baca19ea6c7e23ce71ac5744f6 (patch) | |
tree | fdcc322863442095e8e3a7342037f96862beb7ce /app/javascript/mastodon/features/ui/components/video_modal.js | |
parent | a2ce7508c95f473a77d46a99fc1e090c0defadcc (diff) |
Improve modal flow and back button handling (#16499)
* Refactor shouldUpdateScroll passing So far, shouldUpdateScroll has been manually passed down from the very top of the React component hierarchy even though it is a static function common to all ScrollContainer instances, so replaced that with a custom class extending ScrollContainer. * Generalize “press back to close modal” to any modal and to public pages * Fix boost confirmation modal closing media modal
Diffstat (limited to 'app/javascript/mastodon/features/ui/components/video_modal.js')
-rw-r--r-- | app/javascript/mastodon/features/ui/components/video_modal.js | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/app/javascript/mastodon/features/ui/components/video_modal.js b/app/javascript/mastodon/features/ui/components/video_modal.js index 2f13a175a..7e8e1329d 100644 --- a/app/javascript/mastodon/features/ui/components/video_modal.js +++ b/app/javascript/mastodon/features/ui/components/video_modal.js @@ -6,8 +6,6 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import Footer from 'mastodon/features/picture_in_picture/components/footer'; import { getAverageFromBlurhash } from 'mastodon/blurhash'; -export const previewState = 'previewVideoModal'; - export default class VideoModal extends ImmutablePureComponent { static propTypes = { @@ -22,19 +20,9 @@ export default class VideoModal extends ImmutablePureComponent { onChangeBackgroundColor: PropTypes.func.isRequired, }; - static contextTypes = { - router: PropTypes.object, - }; - componentDidMount () { - const { router } = this.context; const { media, onChangeBackgroundColor, onClose } = this.props; - if (router) { - router.history.push(router.history.location.pathname, previewState); - this.unlistenHistory = router.history.listen(() => onClose()); - } - const backgroundColor = getAverageFromBlurhash(media.get('blurhash')); if (backgroundColor) { @@ -42,18 +30,6 @@ export default class VideoModal extends ImmutablePureComponent { } } - componentWillUnmount () { - const { router } = this.context; - - if (router) { - this.unlistenHistory(); - - if (router.history.location.state === previewState) { - router.history.goBack(); - } - } - } - render () { const { media, statusId, onClose } = this.props; const options = this.props.options || {}; |