From cbcf32777ec12fb7aa434a8b1d4d6a5d9e9356c4 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 23 May 2023 14:28:21 +0200 Subject: [PATCH] Fix video player offering to expand in a lightbox when it's in an iframe (#25067) --- app/javascript/mastodon/containers/media_container.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/containers/media_container.jsx b/app/javascript/mastodon/containers/media_container.jsx index d988808975..ede8641d65 100644 --- a/app/javascript/mastodon/containers/media_container.jsx +++ b/app/javascript/mastodon/containers/media_container.jsx @@ -73,6 +73,13 @@ export default class MediaContainer extends PureComponent { render () { const { locale, components } = this.props; + let handleOpenVideo; + + // Don't offer to expand the video in a lightbox if we're in a frame + if (window.self === window.top) { + handleOpenVideo = this.handleOpenVideo; + } + return ( <> @@ -89,7 +96,7 @@ export default class MediaContainer extends PureComponent { ...(componentName === 'Video' ? { componentIndex: i, - onOpenVideo: this.handleOpenVideo, + onOpenVideo: handleOpenVideo, } : { onOpenMedia: this.handleOpenMedia, }),