From 7687ea7b8760469dc23b4dd9290d7c5f88e2ff4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Wed, 29 Oct 2025 01:20:47 +0100 Subject: [PATCH] pl-fe: more renyames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/pl-fe/src/actions/compose.ts | 12 +++---- packages/pl-fe/src/actions/statuses.ts | 14 ++++---- packages/pl-fe/src/components/modal-root.tsx | 2 +- .../compose/components/compose-form.tsx | 2 +- .../compose/components/privacy-dropdown.tsx | 4 +-- .../compose/components/schedule-button.tsx | 2 +- .../containers/quoted-status-container.tsx | 2 +- .../containers/reply-indicator-container.tsx | 4 +-- .../compose/editor/plugins/state-plugin.tsx | 2 +- packages/pl-fe/src/modals/compose-modal.tsx | 14 ++++---- packages/pl-fe/src/reducers/compose.ts | 32 +++++++++---------- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/packages/pl-fe/src/actions/compose.ts b/packages/pl-fe/src/actions/compose.ts index 142f98dc1..1d4c57cb4 100644 --- a/packages/pl-fe/src/actions/compose.ts +++ b/packages/pl-fe/src/actions/compose.ts @@ -354,7 +354,7 @@ const submitCompose = (composeId: string, opts: SubmitComposeOpts = {}, preview const status = compose.text; const media = compose.mediaAttachments; - const statusId = compose.id; + const editedId = compose.editedId; let to = compose.to; const { forceImplicitAddressing } = useSettingsStore.getState().settings; const explicitAddressing = state.auth.client.features.createStatusExplicitAddressing && !forceImplicitAddressing; @@ -392,7 +392,7 @@ const submitCompose = (composeId: string, opts: SubmitComposeOpts = {}, preview useModalsStore.getState().actions.closeModal('COMPOSE'); - if (compose.language && !statusId && !preview) { + if (compose.language && !editedId && !preview) { useSettingsStore.getState().actions.rememberLanguageUse(compose.language); dispatch(saveSettings()); } @@ -404,7 +404,7 @@ const submitCompose = (composeId: string, opts: SubmitComposeOpts = {}, preview const params: CreateStatusParams = { status, in_reply_to_id: compose.inReplyToId || undefined, - quote_id: compose.quote || undefined, + quote_id: compose.quoteId || undefined, media_ids: media.map(item => item.id), sensitive: compose.sensitive, spoiler_text: compose.spoilerText, @@ -413,7 +413,7 @@ const submitCompose = (composeId: string, opts: SubmitComposeOpts = {}, preview scheduled_at: preview ? undefined : compose.scheduledAt?.toISOString(), language: compose.language || compose.suggestedLanguage || undefined, to: explicitAddressing && to.length ? to : undefined, - local_only: compose.local_only, + local_only: compose.localOnly, interaction_policy: ['public', 'unlisted', 'private'].includes(compose.visibility) && compose.interactionPolicy || undefined, preview, }; @@ -458,8 +458,8 @@ const submitCompose = (composeId: string, opts: SubmitComposeOpts = {}, preview params.overwrite = compose.redactingOverwrite; } - return dispatch(createStatus(params, idempotencyKey, statusId, compose.redacting)).then((data) => { - handleComposeSubmit(dispatch, getState, composeId, data, status, !!statusId, compose.redacting); + return dispatch(createStatus(params, idempotencyKey, editedId, compose.redacting)).then((data) => { + handleComposeSubmit(dispatch, getState, composeId, data, status, !!editedId, compose.redacting); onSuccess?.(); }).catch((error) => { dispatch(submitComposeFail(composeId, error)); diff --git a/packages/pl-fe/src/actions/statuses.ts b/packages/pl-fe/src/actions/statuses.ts index ad50e0b2a..5ba098e7c 100644 --- a/packages/pl-fe/src/actions/statuses.ts +++ b/packages/pl-fe/src/actions/statuses.ts @@ -36,18 +36,18 @@ const STATUS_UNMUTE_SUCCESS = 'STATUS_UNMUTE_SUCCESS' as const; const STATUS_UNFILTER = 'STATUS_UNFILTER' as const; -const createStatus = (params: CreateStatusParams, idempotencyKey: string, statusId: string | null, redacting = false) => +const createStatus = (params: CreateStatusParams, idempotencyKey: string, editedId: string | null, redacting = false) => (dispatch: AppDispatch, getState: () => RootState) => { - if (!params.preview) dispatch({ type: STATUS_CREATE_REQUEST, params, idempotencyKey, editing: !!statusId, redacting }); + if (!params.preview) dispatch({ type: STATUS_CREATE_REQUEST, params, idempotencyKey, editing: !!editedId, redacting }); const client = getClient(getState()); return ( - statusId === null + editedId === null ? client.statuses.createStatus(params) : redacting - ? client.admin.statuses.redactStatus(statusId, params) - : client.statuses.editStatus(statusId, params) + ? client.admin.statuses.redactStatus(editedId, params) + : client.statuses.editStatus(editedId, params) ) .then((status) => { if (params.preview) return status; @@ -61,7 +61,7 @@ const createStatus = (params: CreateStatusParams, idempotencyKey: string, status queryClient.invalidateQueries(scheduledStatusesQueryOptions); } - dispatch({ type: STATUS_CREATE_SUCCESS, status, params, idempotencyKey, editing: !!statusId }); + dispatch({ type: STATUS_CREATE_SUCCESS, status, params, idempotencyKey, editing: !!editedId }); // Poll the backend for the updated card if (expectsCard) { @@ -82,7 +82,7 @@ const createStatus = (params: CreateStatusParams, idempotencyKey: string, status return status; }).catch(error => { - dispatch({ type: STATUS_CREATE_FAIL, error, params, idempotencyKey, editing: !!statusId }); + dispatch({ type: STATUS_CREATE_FAIL, error, params, idempotencyKey, editing: !!editedId }); throw error; }); }; diff --git a/packages/pl-fe/src/components/modal-root.tsx b/packages/pl-fe/src/components/modal-root.tsx index ea168b484..de27378f6 100644 --- a/packages/pl-fe/src/components/modal-root.tsx +++ b/packages/pl-fe/src/components/modal-root.tsx @@ -64,7 +64,7 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) const hasComposeContent = checkComposeContent(compose); if (hasComposeContent && type === 'COMPOSE') { - const isEditing = compose!.id !== null; + const isEditing = compose!.editedId !== null; openModal('CONFIRM', { heading: isEditing ? diff --git a/packages/pl-fe/src/features/compose/components/compose-form.tsx b/packages/pl-fe/src/features/compose/components/compose-form.tsx index 272bc386a..eb2dc68a3 100644 --- a/packages/pl-fe/src/features/compose/components/compose-form.tsx +++ b/packages/pl-fe/src/features/compose/components/compose-form.tsx @@ -148,7 +148,7 @@ const ComposeForm = ({ id, shouldCondense, autoFocus, clickab } = compose; const hasPoll = !!compose.poll; - const isEditing = compose.id !== null; + const isEditing = compose.editedId !== null; const anyMedia = compose.mediaAttachments.length > 0; const [composeFocused, setComposeFocused] = useState(false); diff --git a/packages/pl-fe/src/features/compose/components/privacy-dropdown.tsx b/packages/pl-fe/src/features/compose/components/privacy-dropdown.tsx index d944abbd9..0c8e82a91 100644 --- a/packages/pl-fe/src/features/compose/components/privacy-dropdown.tsx +++ b/packages/pl-fe/src/features/compose/components/privacy-dropdown.tsx @@ -140,7 +140,7 @@ const PrivacyDropdown: React.FC = ({ const isReply = !!compose.inReplyToId; const value = compose.visibility; - const unavailable = compose.id; + const unavailable = !!compose.editedId; const onChange = (value: string) => value && dispatch(changeComposeVisibility(composeId, value)); @@ -162,7 +162,7 @@ const PrivacyDropdown: React.FC = ({ text: intl.formatMessage(messages.local_short), meta: intl.formatMessage(messages.local_long), type: 'toggle', - checked: compose.local_only, + checked: compose.localOnly, onChange: () => dispatch(changeComposeFederated(composeId)), }); diff --git a/packages/pl-fe/src/features/compose/components/schedule-button.tsx b/packages/pl-fe/src/features/compose/components/schedule-button.tsx index ae9bdf46a..67f94970a 100644 --- a/packages/pl-fe/src/features/compose/components/schedule-button.tsx +++ b/packages/pl-fe/src/features/compose/components/schedule-button.tsx @@ -24,7 +24,7 @@ const ScheduleButton: React.FC = ({ composeId, disabled }) => { const compose = useCompose(composeId); const active = !!compose.scheduledAt; - const unavailable = !!compose.id; + const unavailable = !!compose.editedId; const handleClick = () => { if (active) { diff --git a/packages/pl-fe/src/features/compose/containers/quoted-status-container.tsx b/packages/pl-fe/src/features/compose/containers/quoted-status-container.tsx index bfe2b4bee..361f58d16 100644 --- a/packages/pl-fe/src/features/compose/containers/quoted-status-container.tsx +++ b/packages/pl-fe/src/features/compose/containers/quoted-status-container.tsx @@ -15,7 +15,7 @@ const QuotedStatusContainer: React.FC = ({ composeId }) const dispatch = useAppDispatch(); const getStatus = useCallback(makeGetStatus(), []); - const status = useAppSelector(state => getStatus(state, { id: state.compose[composeId]?.quote! })); + const status = useAppSelector(state => getStatus(state, { id: state.compose[composeId]?.quoteId! })); const onCancel = () => { dispatch(cancelQuoteCompose(composeId)); diff --git a/packages/pl-fe/src/features/compose/containers/reply-indicator-container.tsx b/packages/pl-fe/src/features/compose/containers/reply-indicator-container.tsx index bc419d83f..2a2778fca 100644 --- a/packages/pl-fe/src/features/compose/containers/reply-indicator-container.tsx +++ b/packages/pl-fe/src/features/compose/containers/reply-indicator-container.tsx @@ -15,7 +15,7 @@ interface IReplyIndicatorContainer { const ReplyIndicatorContainer: React.FC = ({ composeId }) => { const getStatus = useCallback(makeGetStatus(), []); - const { inReplyToId, id: statusId } = useCompose(composeId); + const { inReplyToId, editedId } = useCompose(composeId); const status = useAppSelector(state => getStatus(state, { id: inReplyToId! })); const dispatch = useAppDispatch(); @@ -26,7 +26,7 @@ const ReplyIndicatorContainer: React.FC = ({ composeId if (!status) return null; return ( - + ); }; diff --git a/packages/pl-fe/src/features/compose/editor/plugins/state-plugin.tsx b/packages/pl-fe/src/features/compose/editor/plugins/state-plugin.tsx index 428f23eda..78314a44b 100644 --- a/packages/pl-fe/src/features/compose/editor/plugins/state-plugin.tsx +++ b/packages/pl-fe/src/features/compose/editor/plugins/state-plugin.tsx @@ -111,7 +111,7 @@ const StatePlugin: React.FC = ({ composeId, isWysiwyg }) => { const state = getState(); const compose = state.compose[composeId]; - if (!features.quotePosts || compose?.quote) return; + if (!features.quotePosts || compose?.quoteId) return; const ids = getStatusIdsFromLinksInContent(text); diff --git a/packages/pl-fe/src/modals/compose-modal.tsx b/packages/pl-fe/src/modals/compose-modal.tsx index aeb3e4380..b4a37e010 100644 --- a/packages/pl-fe/src/modals/compose-modal.tsx +++ b/packages/pl-fe/src/modals/compose-modal.tsx @@ -32,7 +32,7 @@ const ComposeModal: React.FC = ({ onClose, c const { openModal } = useModalsActions(); const persistDraftStatus = usePersistDraftStatus(); - const { id: statusId, visibility, inReplyToId, quote, groupId } = compose; + const { editedId, visibility, inReplyToId, quoteId, groupId } = compose; const { isDragging, isDraggedOver } = useDraggedFiles(node, (files) => { dispatch(uploadCompose(composeId, files, intl)); @@ -41,23 +41,23 @@ const ComposeModal: React.FC = ({ onClose, c const onClickClose = () => { if (checkComposeContent(compose)) { openModal('CONFIRM', { - heading: statusId + heading: editedId ? : compose.draftId ? : , - message: statusId + message: editedId ? : compose.draftId ? : , - confirm: intl.formatMessage(statusId ? messages.cancelEditing : messages.confirm), + confirm: intl.formatMessage(editedId ? messages.cancelEditing : messages.confirm), onConfirm: () => { onClose('COMPOSE'); dispatch(cancelReplyCompose()); }, secondary: intl.formatMessage(messages.saveDraft), - onSecondary: statusId ? undefined : () => { + onSecondary: editedId ? undefined : () => { persistDraftStatus(composeId); onClose('COMPOSE'); dispatch(cancelReplyCompose()); @@ -73,7 +73,7 @@ const ComposeModal: React.FC = ({ onClose, c return ; } else if (compose.redacting) { return ; - } else if (statusId) { + } else if (editedId) { return ; } else if (visibility === 'direct') { return ; @@ -83,7 +83,7 @@ const ComposeModal: React.FC = ({ onClose, c return ; } else if (inReplyToId) { return ; - } else if (quote) { + } else if (quoteId) { return ; } else { return ; diff --git a/packages/pl-fe/src/reducers/compose.ts b/packages/pl-fe/src/reducers/compose.ts index 3b81d539f..960d7d64f 100644 --- a/packages/pl-fe/src/reducers/compose.ts +++ b/packages/pl-fe/src/reducers/compose.ts @@ -117,7 +117,7 @@ interface Compose { contentType: string; interactionPolicy: InteractionPolicy | null; language: Language | string | null; - local_only: boolean; + localOnly: boolean; scheduledAt: Date | null; sensitive: boolean; visibility: string; @@ -125,9 +125,9 @@ interface Compose { // References to other posts/groups/users draftId: string | null; groupId: string | null; - id: string | null; + editedId: string | null; inReplyToId: string | null; - quote: string | null; + quoteId: string | null; to: Array; parentRebloggedById: string | null; @@ -175,16 +175,16 @@ const newCompose = (params: Partial = {}): Compose => ({ contentType: 'text/plain', interactionPolicy: null, language: null, - local_only: false, + localOnly: false, scheduledAt: null, sensitive: false, visibility: 'public', draftId: null, groupId: null, - id: null, + editedId: null, inReplyToId: null, - quote: null, + quoteId: null, to: [], parentRebloggedById: null, @@ -418,7 +418,7 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In compose.parentRebloggedById = action.rebloggedBy?.id || null; compose.text = !action.explicitAddressing ? statusToTextMentions(action.status, action.account) : ''; compose.visibility = privacyPreference(action.status.visibility, defaultCompose.visibility, action.status.list_id, action.conversationScope); - compose.local_only = action.status.local_only === true; + compose.localOnly = action.status.local_only === true; compose.caretPosition = null; compose.idempotencyKey = crypto.randomUUID(); compose.contentType = defaultCompose.contentType; @@ -439,7 +439,7 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In const author = action.status.account.acct; const defaultCompose = state.default; - compose.quote = action.status.id; + compose.quoteId = action.status.id; compose.to = [author]; compose.parentRebloggedById = null; compose.text = ''; @@ -536,8 +536,8 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In return updateCompose(state, 'compose-modal', compose => { if (action.statusId === compose.inReplyToId) { compose.inReplyToId = null; - } if (action.statusId === compose.quote) { - compose.quote = null; + } if (action.statusId === compose.quoteId) { + compose.quoteId = null; } }); case COMPOSE_UPLOAD_CHANGE_SUCCESS: @@ -556,7 +556,7 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In return updateCompose(state, 'compose-modal', compose => { const mentions = action.explicitAddressing ? getExplicitMentions(action.status.account.id, action.status) : []; if (!action.withRedraft && !action.draftId) { - compose.id = action.status.id; + compose.editedId = action.status.id; } compose.text = action.rawText || unescapeHTML(expandMentions(action.status)); compose.to = mentions; @@ -569,7 +569,7 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In ? 'wysiwyg' : action.contentType || 'text/plain'; compose.contentType = contentType; - compose.quote = action.status.quote_id; + compose.quoteId = action.status.quote_id; compose.groupId = action.status.group_id; compose.language = action.status.language; @@ -691,7 +691,7 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In }); case COMPOSE_ADD_SUGGESTED_QUOTE: return updateCompose(state, action.composeId, compose => { - compose.quote = action.quoteId; + compose.quoteId = action.quoteId; }); case COMPOSE_ADD_SUGGESTED_LANGUAGE: return updateCompose(state, action.composeId, compose => { @@ -712,12 +712,12 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In }); case COMPOSE_QUOTE_CANCEL: return updateCompose(state, action.composeId, (compose) => { - if (compose.quote) compose.dismissedQuotes.push(compose.quote); - compose.quote = null; + if (compose.quoteId) compose.dismissedQuotes.push(compose.quoteId); + compose.quoteId = null; }); case COMPOSE_FEDERATED_CHANGE: return updateCompose(state, action.composeId, compose => { - compose.local_only = !compose.local_only; + compose.localOnly = !compose.localOnly; }); case COMPOSE_INTERACTION_POLICY_OPTION_CHANGE: return updateCompose(state, action.composeId, compose => {