]> cat aescling's git repositories - mastodon.git/commitdiff
Fixed issue that the NSFW image is not hidden on detail page (#4244)
authorabcang <abcang1015@gmail.com>
Tue, 18 Jul 2017 13:24:57 +0000 (22:24 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 18 Jul 2017 13:24:57 +0000 (15:24 +0200)
app/javascript/mastodon/components/media_gallery.js

index 89a358e384c0479819fd21777107f43e9ccccf1a..92d7d494e103dc9008f77d6eaffa039eac12f02b 100644 (file)
@@ -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 });
   }