From 4a573270bdccd3fd99a89557303166cccca1546c Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Thu, 20 Oct 2022 12:15:37 -0400 Subject: [PATCH] Rename to 'SensitiveContentOverlay' --- app/soapbox/components/status.tsx | 4 ++-- ...tsx => sensitive-content-overlay.test.tsx} | 20 +++++++++---------- ...rlay.tsx => sensitive-content-overlay.tsx} | 8 +++----- .../status/components/detailed-status.tsx | 4 ++-- app/soapbox/features/status/index.tsx | 4 ++-- 5 files changed, 19 insertions(+), 21 deletions(-) rename app/soapbox/components/statuses/__tests__/{moderation-overlay.test.tsx => sensitive-content-overlay.test.tsx} (86%) rename app/soapbox/components/statuses/{moderation-overlay.tsx => sensitive-content-overlay.tsx} (96%) diff --git a/app/soapbox/components/status.tsx b/app/soapbox/components/status.tsx index 499460cc3..f29091a94 100644 --- a/app/soapbox/components/status.tsx +++ b/app/soapbox/components/status.tsx @@ -18,7 +18,7 @@ import StatusActionBar from './status-action-bar'; import StatusMedia from './status-media'; import StatusReplyMentions from './status-reply-mentions'; import StatusContent from './status_content'; -import ModerationOverlay from './statuses/moderation-overlay'; +import SensitiveContentOverlay from './statuses/sensitive-content-overlay'; import { Card, HStack, Stack, Text } from './ui'; import type { Map as ImmutableMap } from 'immutable'; @@ -362,7 +362,7 @@ const Status: React.FC = (props) => { } > {(inReview || isSensitive) ? ( - ', () => { +describe('', () => { let status: ReducerStatus; describe('when the Status is marked as sensitive', () => { @@ -16,12 +16,12 @@ describe('', () => { }); it('displays the "Sensitive content" warning', () => { - render(); + render(); expect(screen.getByTestId('sensitive-overlay')).toHaveTextContent('Sensitive content'); }); it('can be toggled', () => { - render(); + render(); fireEvent.click(screen.getByTestId('button')); expect(screen.getByTestId('sensitive-overlay')).not.toHaveTextContent('Sensitive content'); @@ -39,12 +39,12 @@ describe('', () => { }); it('displays the "Under review" warning', () => { - render(); + render(); expect(screen.getByTestId('sensitive-overlay')).toHaveTextContent('Content Under Review'); }); it('can be toggled', () => { - render(); + render(); fireEvent.click(screen.getByTestId('button')); expect(screen.getByTestId('sensitive-overlay')).not.toHaveTextContent('Content Under Review'); @@ -62,12 +62,12 @@ describe('', () => { }); it('displays the "Under review" warning', () => { - render(); + render(); expect(screen.getByTestId('sensitive-overlay')).toHaveTextContent('Content Under Review'); }); it('can be toggled', () => { - render(); + render(); fireEvent.click(screen.getByTestId('button')); expect(screen.getByTestId('sensitive-overlay')).not.toHaveTextContent('Content Under Review'); @@ -91,13 +91,13 @@ describe('', () => { }); it('displays the "Under review" warning', () => { - render(, undefined, store); + render(, undefined, store); expect(screen.getByTestId('sensitive-overlay')).not.toHaveTextContent('Sensitive content'); expect(screen.getByTestId('sensitive-overlay')).toHaveTextContent('Hide'); }); it('can be toggled', () => { - render(, undefined, store); + render(, undefined, store); fireEvent.click(screen.getByTestId('button')); expect(screen.getByTestId('sensitive-overlay')).toHaveTextContent('Sensitive content'); diff --git a/app/soapbox/components/statuses/moderation-overlay.tsx b/app/soapbox/components/statuses/sensitive-content-overlay.tsx similarity index 96% rename from app/soapbox/components/statuses/moderation-overlay.tsx rename to app/soapbox/components/statuses/sensitive-content-overlay.tsx index b85414c2e..3d71b549a 100644 --- a/app/soapbox/components/statuses/moderation-overlay.tsx +++ b/app/soapbox/components/statuses/sensitive-content-overlay.tsx @@ -18,13 +18,13 @@ const messages = defineMessages({ show: { id: 'moderation_overlay.show', defaultMessage: 'Show Content' }, }); -interface IModerationOverlay { +interface ISensitiveContentOverlay { status: StatusEntity onToggleVisibility?(): void visible?: boolean } -const ModerationOverlay = (props: IModerationOverlay) => { +const SensitiveContentOverlay = (props: ISensitiveContentOverlay) => { const { onToggleVisibility, status } = props; const isUnderReview = status.visibility === 'self'; const isSensitive = status.sensitive; @@ -32,8 +32,6 @@ const ModerationOverlay = (props: IModerationOverlay) => { const settings = useSettings(); const displayMedia = settings.get('displayMedia') as string | undefined; - // under review ovverides displaymedia - const intl = useIntl(); const { links } = useSoapboxConfig(); @@ -130,4 +128,4 @@ const ModerationOverlay = (props: IModerationOverlay) => { ); }; -export default ModerationOverlay; \ No newline at end of file +export default SensitiveContentOverlay; \ No newline at end of file diff --git a/app/soapbox/features/status/components/detailed-status.tsx b/app/soapbox/features/status/components/detailed-status.tsx index b3811de9b..1131b82df 100644 --- a/app/soapbox/features/status/components/detailed-status.tsx +++ b/app/soapbox/features/status/components/detailed-status.tsx @@ -6,7 +6,7 @@ import Icon from 'soapbox/components/icon'; import StatusMedia from 'soapbox/components/status-media'; import StatusReplyMentions from 'soapbox/components/status-reply-mentions'; import StatusContent from 'soapbox/components/status_content'; -import ModerationOverlay from 'soapbox/components/statuses/moderation-overlay'; +import SensitiveContentOverlay from 'soapbox/components/statuses/sensitive-content-overlay'; import { HStack, Stack, Text } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account_container'; import QuotedStatus from 'soapbox/features/status/containers/quoted_status_container'; @@ -99,7 +99,7 @@ const DetailedStatus: React.FC = ({ } > {(inReview || isSensitive) ? ( - = (props) => { aria-label={textForScreenReader(intl, status)} > {inReview ? ( -