diff --git a/app/soapbox/actions/compose.ts b/app/soapbox/actions/compose.ts index d397f4026..57e7909a1 100644 --- a/app/soapbox/actions/compose.ts +++ b/app/soapbox/actions/compose.ts @@ -54,7 +54,6 @@ const COMPOSE_SUGGESTION_TAGS_UPDATE = 'COMPOSE_SUGGESTION_TAGS_UPDATE'; const COMPOSE_TAG_HISTORY_UPDATE = 'COMPOSE_TAG_HISTORY_UPDATE'; -const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE'; const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE'; const COMPOSE_TYPE_CHANGE = 'COMPOSE_TYPE_CHANGE'; const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE'; @@ -600,11 +599,6 @@ const insertIntoTagHistory = (composeId: string, recognizedTags: APIEntity[], te dispatch(updateTagHistory(composeId, newHistory)); }; -const changeComposeSensitivity = (composeId: string) => ({ - type: COMPOSE_SENSITIVITY_CHANGE, - id: composeId, -}); - const changeComposeSpoilerness = (composeId: string) => ({ type: COMPOSE_SPOILERNESS_CHANGE, id: composeId, @@ -741,7 +735,6 @@ export { COMPOSE_SUGGESTION_SELECT, COMPOSE_SUGGESTION_TAGS_UPDATE, COMPOSE_TAG_HISTORY_UPDATE, - COMPOSE_SENSITIVITY_CHANGE, COMPOSE_SPOILERNESS_CHANGE, COMPOSE_TYPE_CHANGE, COMPOSE_SPOILER_TEXT_CHANGE, @@ -796,7 +789,6 @@ export { selectComposeSuggestion, updateSuggestionTags, updateTagHistory, - changeComposeSensitivity, changeComposeSpoilerness, changeComposeContentType, changeComposeSpoilerText, diff --git a/app/soapbox/features/compose/components/sensitive-button.tsx b/app/soapbox/features/compose/components/sensitive-button.tsx deleted file mode 100644 index 87d5103c5..000000000 --- a/app/soapbox/features/compose/components/sensitive-button.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import React from 'react'; -import { useIntl, defineMessages, FormattedMessage } from 'react-intl'; - -import { changeComposeSensitivity } from 'soapbox/actions/compose'; -import { FormGroup, Checkbox } from 'soapbox/components/ui'; -import { useAppDispatch, useCompose } from 'soapbox/hooks'; - -const messages = defineMessages({ - marked: { id: 'compose_form.sensitive.marked', defaultMessage: 'Media is marked as sensitive' }, - unmarked: { id: 'compose_form.sensitive.unmarked', defaultMessage: 'Media is not marked as sensitive' }, -}); - -interface ISensitiveButton { - composeId: string, -} - -/** Button to mark own media as sensitive. */ -const SensitiveButton: React.FC = ({ composeId }) => { - const intl = useIntl(); - const dispatch = useAppDispatch(); - - const compose = useCompose(composeId); - - const active = compose.sensitive === true; - const disabled = compose.spoiler === true; - - const onClick = () => { - dispatch(changeComposeSensitivity(composeId)); - }; - - return ( -
- } - labelTitle={intl.formatMessage(active ? messages.marked : messages.unmarked)} - > - - -
- ); -}; - -export default SensitiveButton; diff --git a/app/soapbox/features/compose/components/upload_form.tsx b/app/soapbox/features/compose/components/upload_form.tsx index 7ad300528..e9c116b24 100644 --- a/app/soapbox/features/compose/components/upload_form.tsx +++ b/app/soapbox/features/compose/components/upload_form.tsx @@ -3,7 +3,6 @@ import React from 'react'; import { useCompose } from 'soapbox/hooks'; -import SensitiveButton from './sensitive-button'; import Upload from './upload'; import UploadProgress from './upload-progress'; @@ -28,8 +27,6 @@ const UploadForm: React.FC = ({ composeId }) => { ))} - - {!mediaIds.isEmpty() && } ); }; diff --git a/app/soapbox/reducers/__tests__/compose.test.ts b/app/soapbox/reducers/__tests__/compose.test.ts index c8da1c744..1270fb6af 100644 --- a/app/soapbox/reducers/__tests__/compose.test.ts +++ b/app/soapbox/reducers/__tests__/compose.test.ts @@ -181,30 +181,8 @@ describe('compose reducer', () => { }); }); - it('should handle COMPOSE_SENSITIVITY_CHANGE on Mark Sensitive click, don\'t toggle if spoiler active', () => { - const state = initialState.set('home', ReducerCompose({ spoiler: true, sensitive: true, idempotencyKey: '' })); - const action = { - type: actions.COMPOSE_SENSITIVITY_CHANGE, - id: 'home', - }; - expect(reducer(state, action).toJS().home).toMatchObject({ - sensitive: true, - }); - }); - - it('should handle COMPOSE_SENSITIVITY_CHANGE on Mark Sensitive click, toggle if spoiler inactive', () => { - const state = initialState.set('home', ReducerCompose({ spoiler: false, sensitive: true })); - const action = { - type: actions.COMPOSE_SENSITIVITY_CHANGE, - id: 'home', - }; - expect(reducer(state, action).toJS().home).toMatchObject({ - sensitive: false, - }); - }); - it('should handle COMPOSE_SPOILERNESS_CHANGE on CW button click', () => { - const state = initialState.set('home', ReducerCompose({ spoiler_text: 'spoiler text', spoiler: true, media_attachments: ImmutableList() })); + const state = initialState.set('home', ReducerCompose({ spoiler_text: 'spoiler text', spoiler: true, sensitive: true, media_attachments: ImmutableList() })); const action = { type: actions.COMPOSE_SPOILERNESS_CHANGE, id: 'home', @@ -212,6 +190,7 @@ describe('compose reducer', () => { expect(reducer(state, action).toJS().home).toMatchObject({ spoiler: false, spoiler_text: '', + sensitive: false, }); }); diff --git a/app/soapbox/reducers/compose.ts b/app/soapbox/reducers/compose.ts index dcdc4491f..bdfcf3009 100644 --- a/app/soapbox/reducers/compose.ts +++ b/app/soapbox/reducers/compose.ts @@ -26,7 +26,6 @@ import { COMPOSE_SUGGESTION_SELECT, COMPOSE_SUGGESTION_TAGS_UPDATE, COMPOSE_TAG_HISTORY_UPDATE, - COMPOSE_SENSITIVITY_CHANGE, COMPOSE_SPOILERNESS_CHANGE, COMPOSE_TYPE_CHANGE, COMPOSE_SPOILER_TEXT_CHANGE, @@ -279,14 +278,6 @@ export const initialState: State = ImmutableMap({ export default function compose(state = initialState, action: AnyAction) { switch (action.type) { - case COMPOSE_SENSITIVITY_CHANGE: - return updateCompose(state, action.id, compose => compose.withMutations(map => { - if (!compose.spoiler) { - map.set('sensitive', !compose.sensitive); - } - - map.set('idempotencyKey', uuid()); - })); case COMPOSE_TYPE_CHANGE: return updateCompose(state, action.id, compose => compose.withMutations(map => { map.set('content_type', action.value);