From d8c5e624311459fc7e951afa02a6d8123cb621eb Mon Sep 17 00:00:00 2001 From: Echo Date: Thu, 1 Oct 2026 10:43:16 +0000 Subject: [PATCH] Status redesign: Show more generic reply text to reduce server load (#40793) --- .../components/status/prepend.module.scss | 13 +-- .../mastodon/components/status/prepend.tsx | 101 +++++++++--------- app/javascript/mastodon/locales/en.json | 3 + 3 files changed, 54 insertions(+), 63 deletions(-) diff --git a/app/javascript/mastodon/components/status/prepend.module.scss b/app/javascript/mastodon/components/status/prepend.module.scss index d399dfb2136..15cb677687b 100644 --- a/app/javascript/mastodon/components/status/prepend.module.scss +++ b/app/javascript/mastodon/components/status/prepend.module.scss @@ -28,6 +28,8 @@ padding-inline-end: var(--col-gap); justify-self: end; color: var(--color-text-tertiary); + width: 1rem; + height: 1rem; } .replyIcon { @@ -50,14 +52,3 @@ a.account { font-weight: bold; } - -.text blockquote { - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - margin-block-start: var(--space-1); - - > p { - display: inline; - } -} diff --git a/app/javascript/mastodon/components/status/prepend.tsx b/app/javascript/mastodon/components/status/prepend.tsx index ecb4d9dea2c..ab50c5747f4 100644 --- a/app/javascript/mastodon/components/status/prepend.tsx +++ b/app/javascript/mastodon/components/status/prepend.tsx @@ -4,18 +4,17 @@ import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; -import { ArrowsClockwiseIcon } from '@phosphor-icons/react'; - import { useAccountStatus } from '@/mastodon/hooks/useStatus'; import type { ExpandedStatusShape } from '@/mastodon/models/status'; +import { selectPlainAccount } from '@/mastodon/selectors/accounts'; +import { useAppSelector } from '@/mastodon/store'; import { Avatar } from '../avatar'; import { DisplayName } from '../display_name'; -import { EmojiHTML } from '../emoji/html'; import { Icon } from '../icon'; import { RelativeTimestamp } from '../relative_timestamp'; -import { onStatusLinksDisabled } from './hooks'; +import { StatusBoostIcon } from './icons'; import classes from './prepend.module.scss'; import { statusLink } from './utils'; @@ -31,15 +30,21 @@ export const StatusPrepend: React.FC<{ return ( <> {!!reblogId && } - {showThread && !!status.in_reply_to_id && ( - - )} + {showThread && + !!status.in_reply_to_id && + !!status.in_reply_to_account_id && ( + + )} ); }; const StatusPrependReblog: React.FC<{ reblogId: string }> = ({ reblogId }) => { - const status = useAccountStatus(reblogId, true); + const status = useAccountStatus(reblogId); if (!status) { return null; } @@ -57,7 +62,7 @@ const StatusPrependReblog: React.FC<{ reblogId: string }> = ({ reblogId }) => { }; return (
- + @@ -81,56 +86,48 @@ const StatusPrependReblog: React.FC<{ reblogId: string }> = ({ reblogId }) => { ); }; -const StatusPrependReply: React.FC<{ replyId: string }> = ({ replyId }) => { - const status = useAccountStatus(replyId, true); +const StatusPrependReply: React.FC<{ + statusAccountId: string; + replyId: string; + replyAccountId: string; +}> = ({ statusAccountId, replyId, replyAccountId }) => { + const accountId = replyAccountId; + const account = useAppSelector((state) => + selectPlainAccount(state, accountId), + ); - if (!status) { - return null; + let label: React.ReactNode; + if (statusAccountId === replyAccountId) { + label = ( + + ); + } else if (account) { + label = ( + , + }} + /> + ); + } else { + label = ( + + ); } - const account = status.account; - const accountLinkProps = { - to: { - pathname: `/@${account.acct}`, - state: { reference: 'status' }, - }, - title: `@${account.acct}`, - 'data-id': account.id, - 'data-hover-card-account': account.id, - 'data-hover-card-reference': 'status', - }; - - const language = status.translation?.language ?? status.language; - const content = ( - status.translation?.contentHtml ?? status.contentHtml - ).trim(); - return (
-
- - - - - - - - - - {!!content && ( - - - - )} -
+ {label}
); }; diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 3d370c2889f..8518ec74a7a 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -1401,6 +1401,7 @@ "status.context.retry": "Retry", "status.context.show": "Show", "status.continued_thread": "Continued thread", + "status.continuing_thread": "Continuing a thread", "status.copied": "Copied post link to clipboard", "status.copy": "Copy link to post", "status.delete": "Delete", @@ -1478,6 +1479,8 @@ "status.replies_count": "{count, plural, one {{counter} reply} other {{counter} replies}}", "status.reply": "Reply", "status.replyAll": "Reply to thread", + "status.replying_to": "Replying to {name}", + "status.replying_to_thread": "Replying to thread", "status.report": "Report @{name}", "status.request_quote": "Request to quote", "status.revoke_quote": "Remove my post from @{name}’s post",