about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/status.js
diff options
context:
space:
mode:
authorpluralcafe-docker <git@plural.cafe>2018-09-03 23:46:14 +0000
committerpluralcafe-docker <git@plural.cafe>2018-09-03 23:46:14 +0000
commit1e6f96168146b89df9940d2b77963a7a30ba84cb (patch)
tree06e1a473f10ff6f1c3743e1ff729f95be6d134e5 /app/javascript/flavours/glitch/components/status.js
parentcc7437e25597e24b9a5f06f7991861506d9abe5c (diff)
parent40d04a3209871b9803b27d01f935ab401bf3539f (diff)
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/flavours/glitch/components/status.js')
-rw-r--r--app/javascript/flavours/glitch/components/status.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js
index 1ac5a4b3e..9f47abfef 100644
--- a/app/javascript/flavours/glitch/components/status.js
+++ b/app/javascript/flavours/glitch/components/status.js
@@ -13,6 +13,7 @@ import { MediaGallery, Video } from 'flavours/glitch/util/async-components';
 import { HotKeys } from 'react-hotkeys';
 import NotificationOverlayContainer from 'flavours/glitch/features/notifications/containers/overlay_container';
 import classNames from 'classnames';
+import { autoUnfoldCW } from 'flavours/glitch/util/content_warning';
 
 // We use the component (and not the container) since we do not want
 // to use the progress bar to show download progress
@@ -56,6 +57,7 @@ export default class Status extends ImmutablePureComponent {
   state = {
     isCollapsed: false,
     autoCollapsed: false,
+    isExpanded: undefined,
   }
 
   // Avoid checking props that are functions (and whose equality will always
@@ -123,6 +125,17 @@ export default class Status extends ImmutablePureComponent {
       updated = true;
     }
 
+    if (nextProps.expanded === undefined &&
+      prevState.isExpanded === undefined &&
+      update.isExpanded === undefined
+    ) {
+      const isExpanded = autoUnfoldCW(nextProps.settings, nextProps.status);
+      if (isExpanded !== undefined) {
+        update.isExpanded = isExpanded;
+        updated = true;
+      }
+    }
+
     return updated ? update : null;
   }