about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/status_content.js
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-09-08 14:39:14 +0200
committerClaire <claire.github-309c@sitedethib.com>2021-09-08 16:36:30 +0200
commit6bbcd99f1407bf0a34fb7367d4fae42f058c8ac7 (patch)
tree04c368363bf3361d2895c8c0de265b9e5996e22c /app/javascript/flavours/glitch/components/status_content.js
parente2921375c3dee8b9fec47b0267edcecef380bc42 (diff)
Fix media attachments not being displayed on polls
Fixes #1595
Diffstat (limited to 'app/javascript/flavours/glitch/components/status_content.js')
-rw-r--r--app/javascript/flavours/glitch/components/status_content.js51
1 files changed, 29 insertions, 22 deletions
diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js
index faa1302c4..3a9b23228 100644
--- a/app/javascript/flavours/glitch/components/status_content.js
+++ b/app/javascript/flavours/glitch/components/status_content.js
@@ -69,7 +69,7 @@ export default class StatusContent extends React.PureComponent {
     expanded: PropTypes.bool,
     collapsed: PropTypes.bool,
     onExpandedToggle: PropTypes.func,
-    media: PropTypes.element,
+    media: PropTypes.node,
     mediaIcon: PropTypes.string,
     parseClick: PropTypes.func,
     disabled: PropTypes.bool,
@@ -286,28 +286,35 @@ export default class StatusContent extends React.PureComponent {
         </Permalink>
       )).reduce((aggregate, item) => [...aggregate, item, ' '], []);
 
-      const toggleText = hidden ? [
-        <FormattedMessage
-          id='status.show_more'
-          defaultMessage='Show more'
-          key='0'
-        />,
-        mediaIcon ? (
-          <Icon
-            fixedWidth
-            className='status__content__spoiler-icon'
-            id={mediaIcon}
-            aria-hidden='true'
-            key='1'
+      let toggleText = null;
+      if (hidden) {
+        toggleText = [
+          <FormattedMessage
+            id='status.show_more'
+            defaultMessage='Show more'
+            key='0'
+          />,
+        ];
+        if (mediaIcon) {
+          toggleText.push(
+            <Icon
+              fixedWidth
+              className='status__content__spoiler-icon'
+              id={mediaIcon}
+              aria-hidden='true'
+              key='1'
+            />,
+          );
+        }
+      } else {
+        toggleText = (
+          <FormattedMessage
+            id='status.show_less'
+            defaultMessage='Show less'
+            key='0'
           />
-        ) : null,
-      ] : [
-        <FormattedMessage
-          id='status.show_less'
-          defaultMessage='Show less'
-          key='0'
-        />,
-      ];
+        );
+      }
 
       if (hidden) {
         mentionsPlaceholder = <div>{mentionLinks}</div>;