From afa52e4d636f8fdc4b21b90e4f006d8ea434b4e9 Mon Sep 17 00:00:00 2001 From: abcang Date: Tue, 18 Jul 2017 22:24:57 +0900 Subject: [PATCH] Fixed issue that the NSFW image is not hidden on detail page (#4244) --- app/javascript/mastodon/components/media_gallery.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/mastodon/components/media_gallery.js index 89a358e38..92d7d494e 100644 --- a/app/javascript/mastodon/components/media_gallery.js +++ b/app/javascript/mastodon/components/media_gallery.js @@ -183,6 +183,12 @@ export default class MediaGallery extends React.PureComponent { visible: !this.props.sensitive, }; + componentWillReceiveProps (nextProps) { + if (nextProps.sensitive !== this.props.sensitive) { + this.setState({ visible: !nextProps.sensitive }); + } + } + handleOpen = () => { this.setState({ visible: !this.state.visible }); }