Insert newly created post into account timelines (#39733)

This commit is contained in:
Echo authored and GitHub committed 2026-07-07 08:51:39 +00:00
1 parent 3124003705
commit 70bca21056
3 files changed
+46 -13

No files matched your search

+10 -7
View File
@@ -14,6 +14,7 @@ import { useEmoji } from './emojis';
import { importFetchedAccounts, importFetchedStatus } from './importer';
import { openModal } from './modal';
import { updateTimeline } from './timelines';
import { insertStatusIntoAccountTimelines } from './timelines_typed';
/** @type {AbortController | undefined} */
let fetchComposeSuggestionsAccountsController;
@@ -189,13 +190,13 @@ export function directCompose(account) {
export function submitCompose(successCallback) {
return function (dispatch, getState) {
const status = getState().getIn(['compose', 'text'], '');
const media = getState().getIn(['compose', 'media_attachments']);
const statusId = getState().getIn(['compose', 'id'], null);
const hasQuote = !!getState().getIn(['compose', 'quoted_status_id']);
const statusText = getState().getIn(['compose', 'text'], '');
const media = getState().getIn(['compose', 'media_attachments']);
const statusId = getState().getIn(['compose', 'id'], null);
const hasQuote = !!getState().getIn(['compose', 'quoted_status_id']);
const spoiler_text = getState().getIn(['compose', 'spoiler']) ? getState().getIn(['compose', 'spoiler_text'], '') : '';
const fulltext = `${spoiler_text ?? ''}${countableText(status ?? '')}`;
const fulltext = `${spoiler_text ?? ''}${countableText(statusText ?? '')}`;
const hasText = fulltext.trim().length > 0;
if (!(hasText || media.size !== 0 || (hasQuote && spoiler_text?.length))) {
@@ -234,7 +235,7 @@ export function submitCompose(successCallback) {
url: statusId === null ? '/api/v1/statuses' : `/api/v1/statuses/${statusId}`,
method: statusId === null ? 'post' : 'put',
data: {
status,
status: statusText,
spoiler_text,
in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
media_ids: media.map(item => item.get('id')),
@@ -254,7 +255,7 @@ export function submitCompose(successCallback) {
browserHistory.goBack();
}
dispatch(insertIntoTagHistory(response.data.tags, status));
dispatch(insertIntoTagHistory(response.data.tags, statusText));
dispatch(submitComposeSuccess({ ...response.data }));
if (typeof successCallback === 'function') {
successCallback(response.data);
@@ -284,6 +285,8 @@ export function submitCompose(successCallback) {
insertIfOnline(`account:${response.data.account.id}`);
}
dispatch(insertStatusIntoAccountTimelines({ ...response.data }))
dispatch(showAlert({
message: statusId === null ? messages.published : messages.saved,
action: messages.open,