about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/status/components
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-07-24 13:48:31 +0200
committerGitHub <noreply@github.com>2022-07-24 13:48:31 +0200
commit82f1e0945eed6e80a4e626580df45f7f73427755 (patch)
tree99ea23e2f3a24361b7438dd14db7a06fc10040ed /app/javascript/flavours/glitch/features/status/components
parent85d0e3474574d82fc653925560d2905cee43287e (diff)
parenta5f81e1abd82cb66e590b73af83c720d6410fafd (diff)
Merge pull request #1813 from ClearlyClaire/glitch-soc/features/out-of-content-media
Add local setting toggle to move media attachments outside CWs
Diffstat (limited to 'app/javascript/flavours/glitch/features/status/components')
-rw-r--r--app/javascript/flavours/glitch/features/status/components/detailed_status.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/app/javascript/flavours/glitch/features/status/components/detailed_status.js b/app/javascript/flavours/glitch/features/status/components/detailed_status.js
index f4e6c24c5..301a2add6 100644
--- a/app/javascript/flavours/glitch/features/status/components/detailed_status.js
+++ b/app/javascript/flavours/glitch/features/status/components/detailed_status.js
@@ -122,14 +122,27 @@ class DetailedStatus extends ImmutablePureComponent {
       return null;
     }
 
-    let media           = [];
-    let mediaIcons      = [];
     let applicationLink = '';
     let reblogLink = '';
     let reblogIcon = 'retweet';
     let favouriteLink = '';
     let edited = '';
 
+    //  Depending on user settings, some media are considered as parts of the
+    //  contents (affected by CW) while other will be displayed outside of the
+    //  CW.
+    let contentMedia = [];
+    let contentMediaIcons = [];
+    let extraMedia = [];
+    let extraMediaIcons = [];
+    let media = contentMedia;
+    let mediaIcons = contentMediaIcons;
+
+    if (settings.getIn(['content_warnings', 'media_outside'])) {
+      media = extraMedia;
+      mediaIcons = extraMediaIcons;
+    }
+
     if (this.props.measureHeight) {
       outerStyle.height = `${this.state.height}px`;
     }
@@ -199,8 +212,8 @@ class DetailedStatus extends ImmutablePureComponent {
     }
 
     if (status.get('poll')) {
-      media.push(<PollContainer pollId={status.get('poll')} />);
-      mediaIcons.push('tasks');
+      contentMedia.push(<PollContainer pollId={status.get('poll')} />);
+      contentMediaIcons.push('tasks');
     }
 
     if (status.get('application')) {
@@ -282,8 +295,9 @@ class DetailedStatus extends ImmutablePureComponent {
 
           <StatusContent
             status={status}
-            media={media}
-            mediaIcons={mediaIcons}
+            media={contentMedia}
+            extraMedia={extraMedia}
+            mediaIcons={contentMediaIcons}
             expanded={expanded}
             collapsed={false}
             onExpandedToggle={onToggleHidden}