From 3f4e27ab6f33ab1a18954a3046e6e9abdc2d5e12 Mon Sep 17 00:00:00 2001 From: Claire Date: Sun, 24 Jul 2022 11:10:49 +0200 Subject: Add local setting toggle to move media attachments outside CWs Fixes #1812 --- .../flavours/glitch/components/status.js | 30 +++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'app/javascript/flavours/glitch/components') diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js index 8a5fda676..d3bdcdc91 100644 --- a/app/javascript/flavours/glitch/components/status.js +++ b/app/javascript/flavours/glitch/components/status.js @@ -508,8 +508,21 @@ class Status extends ImmutablePureComponent { const { isExpanded, isCollapsed, forceFilter } = this.state; let background = null; let attachments = null; - let media = []; - let mediaIcons = []; + + // 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 (status === null) { return null; @@ -681,8 +694,8 @@ class Status extends ImmutablePureComponent { } if (status.get('poll')) { - media.push(); - mediaIcons.push('tasks'); + contentMedia.push(); + contentMediaIcons.push('tasks'); } // Here we prepare extra data-* attributes for CSS selectors. @@ -748,7 +761,7 @@ class Status extends ImmutablePureComponent { + + {extraMedia} + {!isCollapsed || !(muted || !settings.getIn(['collapsed', 'show_action_bar'])) ? (