diff --git a/app/soapbox/components/__tests__/status.test.tsx b/app/soapbox/components/__tests__/status.test.tsx new file mode 100644 index 000000000..ea9d04d98 --- /dev/null +++ b/app/soapbox/components/__tests__/status.test.tsx @@ -0,0 +1,42 @@ +import React from 'react'; + +import { render, screen, rootState } from '../../jest/test-helpers'; +import { normalizeStatus, normalizeAccount } from '../../normalizers'; +import Status from '../status'; + +import type { ReducerStatus } from 'soapbox/reducers/statuses'; + +const account = normalizeAccount({ + id: '1', + acct: 'alex', +}); + +const status = normalizeStatus({ + id: '1', + account, + content: 'hello world', + contentHtml: 'hello world', +}) as ReducerStatus; + +describe('', () => { + const state = rootState.setIn(['accounts', '1'], account); + + it('renders content', () => { + render(, undefined, state); + screen.getByText(/hello world/i); + expect(screen.getByTestId('status')).toHaveTextContent(/hello world/i); + }); + + describe('the Status Action Bar', () => { + it('is rendered', () => { + render(, undefined, state); + expect(screen.getByTestId('status-action-bar')).toBeInTheDocument(); + }); + + it('is not rendered if status is under review', () => { + const inReviewStatus = normalizeStatus({ ...status, visibility: 'self' }); + render(, undefined, state); + expect(screen.queryAllByTestId('status-action-bar')).toHaveLength(0); + }); + }); +}); diff --git a/app/soapbox/components/status-action-bar.tsx b/app/soapbox/components/status-action-bar.tsx index a5bd99d71..574d5f6e0 100644 --- a/app/soapbox/components/status-action-bar.tsx +++ b/app/soapbox/components/status-action-bar.tsx @@ -279,12 +279,12 @@ const StatusActionBar: React.FC = ({ }; const handleCopy: React.EventHandler = (e) => { - const { uri } = status; + const { uri } = status; const textarea = document.createElement('textarea'); e.stopPropagation(); - textarea.textContent = uri; + textarea.textContent = uri; textarea.style.position = 'fixed'; document.body.appendChild(textarea); @@ -552,6 +552,7 @@ const StatusActionBar: React.FC = ({ return (
= (props) => { const accountAction = props.accountAction || reblogElement; - const inReview = actualStatus.visibility === 'self'; + const isUnderReview = actualStatus.visibility === 'self'; const isSensitive = actualStatus.hidden; return ( @@ -354,11 +354,11 @@ const Status: React.FC = (props) => { - {(inReview || isSensitive) && ( + {(isUnderReview || isSensitive) && ( = (props) => { - {!hideActionBar && ( + {(!hideActionBar && !isUnderReview) && (
diff --git a/app/soapbox/features/status/index.tsx b/app/soapbox/features/status/index.tsx index dbcc373ee..2d419ca84 100644 --- a/app/soapbox/features/status/index.tsx +++ b/app/soapbox/features/status/index.tsx @@ -134,6 +134,7 @@ const Thread: React.FC = (props) => { const me = useAppSelector(state => state.me); const status = useAppSelector(state => getStatus(state, { id: props.params.statusId })); const displayMedia = settings.get('displayMedia') as DisplayMedia; + const isUnderReview = status?.visibility === 'self'; const { ancestorsIds, descendantsIds } = useAppSelector(state => { let ancestorsIds = ImmutableOrderedSet(); @@ -412,7 +413,7 @@ const Thread: React.FC = (props) => { if (next && status) { dispatch(fetchNext(status.id, next)).then(({ next }) => { setNext(next); - }).catch(() => {}); + }).catch(() => { }); } }, 300, { leading: true }), [next, status]); @@ -475,14 +476,18 @@ const Thread: React.FC = (props) => { onOpenCompareHistoryModal={handleOpenCompareHistoryModal} /> -
+ {!isUnderReview ? ( + <> +
- + + + ) : null}