diff --git a/app/javascript/mastodon/components/status/header.tsx b/app/javascript/mastodon/components/status/header.tsx index cfa5b360ce3..1e882074ff7 100644 --- a/app/javascript/mastodon/components/status/header.tsx +++ b/app/javascript/mastodon/components/status/header.tsx @@ -5,6 +5,8 @@ import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import { Link } from 'react-router-dom'; +import { useAccount } from '@/mastodon/hooks/useAccount'; +import { useCurrentAccountId } from '@/mastodon/hooks/useAccountId'; import type { AccountStatusShape } from '@/mastodon/models/status'; import { Avatar } from '../avatar'; @@ -32,6 +34,10 @@ export const StatusRedesignHeader: React.FC = ({ }) => { const account = status.account; const handle = useAccountHandle(account); + const currentAccountId = useCurrentAccountId(); + const firstMentionAccount = useAccount( + status.mentions.find(({ id }) => id !== currentAccountId)?.id, + ); const handleId = useId(); const accountLinkProps = { @@ -64,16 +70,35 @@ export const StatusRedesignHeader: React.FC = ({ values={{ author: displayName, count: status.mentions.length }} /> ); - } else if (status.visibility === 'direct') { - displayName = ( - - ); + } else if (status.visibility === 'direct' && status.mentions.length > 0) { + if (status.account.id === currentAccountId && firstMentionAccount) { + displayName = ( + + ), + // Minus two, as we're removing the current user as well. + count: Math.max(status.mentions.length - 2, 0), + }} + /> + ); + } else { + displayName = ( + + ); + } } return ( diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index c786179c236..de76ddefda0 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -1406,6 +1406,7 @@ "status.favourites_count": "{count, plural, one {{counter} favorite} other {{counter} favorites}}", "status.filter": "Filter this post", "status.follow": "Follow @{name}", + "status.header.message_from_me": "{author} to {name} {count, plural, =0 {} one {+ # other} other {+ # others}}", "status.header.message_to_me": "{author} to You {count, plural, =0 {} one {+ # other} other {+ # others}}", "status.header.to_followers": "{author} to Followers {count, plural, =0 {} one {+ # other} other {+ # others}}", "status.history.created": "{name} created {date}",