From 86527024aa392ad6edf5b1d0dc7fe936b7ad4968 Mon Sep 17 00:00:00 2001
From: Thibaut Girka <thib@sitedethib.com>
Date: Thu, 15 Nov 2018 15:35:13 +0100
Subject: [PATCH] In detailed status view, take displayMedia setting into
 account when changing media

Fixes #819
---
 app/javascript/flavours/glitch/components/media_gallery.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/javascript/flavours/glitch/components/media_gallery.js b/app/javascript/flavours/glitch/components/media_gallery.js
index e8dfd6f8e..d637d7c8e 100644
--- a/app/javascript/flavours/glitch/components/media_gallery.js
+++ b/app/javascript/flavours/glitch/components/media_gallery.js
@@ -232,7 +232,7 @@ export default class MediaGallery extends React.PureComponent {
 
   componentWillReceiveProps (nextProps) {
     if (!is(nextProps.media, this.props.media)) {
-      this.setState({ visible: !nextProps.sensitive });
+      this.setState({ visible: nextProps.revealed === undefined ? (displayMedia !== 'hide_all' && !nextProps.sensitive || displayMedia === 'show_all') : nextProps.revealed });
     }
   }