[Glitch] Redesign composer thunks

Port cd909b22c0 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo authored and Claire committed 2026-07-28 18:18:19 +02:00
1 parent ebdc40b245
commit f39e0c1cb4
14 files changed
+128 -56

No files matched your search

@@ -38,7 +38,7 @@ type Language = [string, string, string];
const getFrequentlyUsedLanguages = createSelector(
[
(state: RootState) =>
(state.settings as ImmutableMap<string, unknown>).get(
state.settings.get(
'frequentlyUsedLanguages',
ImmutableMap(),
) as ImmutableMap<string, number>,
@@ -10,9 +10,8 @@ import {
insertEmojiCompose,
uploadCompose,
} from 'flavours/glitch/actions/compose';
import { pasteLinkCompose } from 'flavours/glitch/actions/compose_typed';
import { pasteLinkCompose, PRIVATE_QUOTE_MODAL_ID } from 'flavours/glitch/actions/compose_typed';
import { openModal } from 'flavours/glitch/actions/modal';
import { PRIVATE_QUOTE_MODAL_ID } from 'flavours/glitch/features/ui/components/confirmation_modals/private_quote_notify';
import { me } from 'flavours/glitch/initial_state';
import { privacyPreference } from 'flavours/glitch/utils/privacy_preference';
@@ -89,7 +88,7 @@ const mapDispatchToProps = (dispatch, props) => ({
dispatch(changeCompose(text));
},
onSubmit ({ missingAltText, quoteToPrivate, overridePrivacy = null }) {
onSubmit ({ missingAltText, quoteToPrivate, overridePrivacy }) {
if (missingAltText) {
dispatch(openModal({
modalType: 'CONFIRM_MISSING_ALT_TEXT',
@@ -101,11 +100,11 @@ const mapDispatchToProps = (dispatch, props) => ({
modalProps: {},
}));
} else {
dispatch(submitCompose(overridePrivacy, (status) => {
dispatch(submitCompose((status) => {
if (props.redirectOnSuccess) {
window.location.assign(status.url);
}
}));
}, overridePrivacy));
}
},
@@ -65,10 +65,7 @@ const Compose: React.FC<{ multiColumn: boolean }> = ({ multiColumn }) => {
const intl = useIntl();
const dispatch = useAppDispatch();
const columns = useAppSelector(
(state) =>
(state.settings as ImmutableMap<string, unknown>).get(
'columns',
) as ImmutableList<ColumnMap>,
(state) => state.settings.get('columns') as ImmutableList<ColumnMap>,
);
const unreadNotifications = useAppSelector(
(state) => state.notifications.get('unread', 0) as number,