From 8a50412f2891f34e4fca8c431eb68ee2a00e22d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 30 Aug 2024 00:05:19 +0200 Subject: [PATCH] Fix sensitive content overlay behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../src/components/statuses/sensitive-content-overlay.tsx | 7 ++++--- packages/pl-fe/src/locales/en.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx b/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx index 7a8f57e58..e00319b89 100644 --- a/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx +++ b/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import { toggleStatusMediaHidden } from 'pl-fe/actions/statuses'; +import { hideStatusMedia, revealStatusMedia, toggleStatusMediaHidden } from 'pl-fe/actions/statuses'; import { useAppDispatch, useSettings } from 'pl-fe/hooks'; import { Button, HStack, Text } from '../ui'; @@ -17,7 +17,7 @@ const messages = defineMessages({ hide: { id: 'moderation_overlay.hide', defaultMessage: 'Hide content' }, sensitiveTitle: { id: 'status.sensitive_warning', defaultMessage: 'Sensitive content' }, sensitiveSubtitle: { id: 'status.sensitive_warning.subtitle', defaultMessage: 'This content may not be suitable for all audiences.' }, - show: { id: 'moderation_overlay.show', defaultMessage: 'Show Content' }, + show: { id: 'moderation_overlay.show', defaultMessage: 'Show content' }, }); interface ISensitiveContentOverlay { @@ -42,7 +42,8 @@ const SensitiveContentOverlay = React.forwardRef) => { event.stopPropagation(); - dispatch(toggleStatusMediaHidden(status)); + if (visible) dispatch(hideStatusMedia(status.id)); + else dispatch(revealStatusMedia(status.id)); }; if (visible && !showHideButton) return null; diff --git a/packages/pl-fe/src/locales/en.json b/packages/pl-fe/src/locales/en.json index eccaf6b2c..acfebd950 100644 --- a/packages/pl-fe/src/locales/en.json +++ b/packages/pl-fe/src/locales/en.json @@ -1057,7 +1057,7 @@ "missing_indicator.label": "Not found", "missing_indicator.sublabel": "This resource could not be found", "moderation_overlay.hide": "Hide content", - "moderation_overlay.show": "Show Content", + "moderation_overlay.show": "Show content", "mute_modal.auto_expire": "Automatically expire mute?", "mute_modal.duration": "Duration", "mute_modal.hide_notifications": "Hide notifications from this user?",