From 9a5f2bbc7758bcd6f131218e933247a6146dde7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 21 Apr 2024 22:06:53 +0200 Subject: [PATCH] Merge expandSpoilers and displayMedia into a single option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/actions/settings.ts | 1 - src/actions/status-quotes.test.ts | 4 ++-- src/components/quoted-status.tsx | 10 ++++------ src/components/status.tsx | 13 +++++-------- .../statuses/sensitive-content-overlay.tsx | 17 +++++++++-------- src/features/preferences/index.tsx | 6 +----- .../status/components/detailed-status.tsx | 14 +++++--------- src/locales/en.json | 3 +-- src/schemas/soapbox/settings.ts | 1 - 9 files changed, 27 insertions(+), 42 deletions(-) diff --git a/src/actions/settings.ts b/src/actions/settings.ts index ae26af50a..102cbca19 100644 --- a/src/actions/settings.ts +++ b/src/actions/settings.ts @@ -31,7 +31,6 @@ const defaultSettings = ImmutableMap({ underlineLinks: false, autoPlayGif: true, displayMedia: 'default', - expandSpoilers: false, unfollowModal: false, boostModal: false, deleteModal: true, diff --git a/src/actions/status-quotes.test.ts b/src/actions/status-quotes.test.ts index 85edb8994..62b369280 100644 --- a/src/actions/status-quotes.test.ts +++ b/src/actions/status-quotes.test.ts @@ -46,7 +46,7 @@ describe('fetchStatusQuotes()', () => { { type: 'STATUS_QUOTES_FETCH_REQUEST', statusId }, { type: 'POLLS_IMPORT', polls: [] }, { type: 'ACCOUNTS_IMPORT', accounts: [status.account] }, - { type: 'STATUSES_IMPORT', statuses: [status], expandSpoilers: false }, + { type: 'STATUSES_IMPORT', statuses: [status] }, { type: 'STATUS_QUOTES_FETCH_SUCCESS', statusId, statuses: [status], next: null }, ]; await store.dispatch(fetchStatusQuotes(statusId)); @@ -118,7 +118,7 @@ describe('expandStatusQuotes()', () => { { type: 'STATUS_QUOTES_EXPAND_REQUEST', statusId }, { type: 'POLLS_IMPORT', polls: [] }, { type: 'ACCOUNTS_IMPORT', accounts: [status.account] }, - { type: 'STATUSES_IMPORT', statuses: [status], expandSpoilers: false }, + { type: 'STATUSES_IMPORT', statuses: [status] }, { type: 'STATUS_QUOTES_EXPAND_SUCCESS', statusId, statuses: [status], next: null }, ]; await store.dispatch(expandStatusQuotes(statusId)); diff --git a/src/components/quoted-status.tsx b/src/components/quoted-status.tsx index e5f771cc5..eb8acf4c8 100644 --- a/src/components/quoted-status.tsx +++ b/src/components/quoted-status.tsx @@ -109,12 +109,10 @@ const QuotedStatus: React.FC = ({ status, onCancel, compose }) => className='relative z-0' style={{ minHeight: status.sensitive ? Math.max(minHeight, 208) + 12 : undefined }} > - {status.sensitive && ( - - )} + = (props) => { react: handleHotkeyReact, }; - const isSensitive = actualStatus.sensitive; const isSoftDeleted = status.tombstone?.reason === 'deleted'; if (isSoftDeleted) { @@ -424,14 +423,12 @@ const Status: React.FC = (props) => { - {(isSensitive) && ( - - )} + {actualStatus.event ? : ( diff --git a/src/components/statuses/sensitive-content-overlay.tsx b/src/components/statuses/sensitive-content-overlay.tsx index 2bbd6890d..d18dd4d8f 100644 --- a/src/components/statuses/sensitive-content-overlay.tsx +++ b/src/components/statuses/sensitive-content-overlay.tsx @@ -29,16 +29,15 @@ const SensitiveContentOverlay = React.forwardRef) => { event.stopPropagation(); @@ -46,6 +45,8 @@ const SensitiveContentOverlay = React.forwardRef { - {features.spoilers && }> - - } - }> diff --git a/src/features/status/components/detailed-status.tsx b/src/features/status/components/detailed-status.tsx index 547cc32ce..d3a4b65be 100644 --- a/src/features/status/components/detailed-status.tsx +++ b/src/features/status/components/detailed-status.tsx @@ -85,8 +85,6 @@ const DetailedStatus: React.FC = ({ const { account } = actualStatus; if (!account || typeof account !== 'object') return null; - const isSensitive = actualStatus.sensitive; - let statusTypeIcon = null; let quote; @@ -128,14 +126,12 @@ const DetailedStatus: React.FC = ({ - {isSensitive && ( - - )} +