diff --git a/app/javascript/mastodon/features/notifications_v2/components/embedded_status.tsx b/app/javascript/mastodon/features/notifications_v2/components/embedded_status.tsx index 88e65c668b..33b813d2ec 100644 --- a/app/javascript/mastodon/features/notifications_v2/components/embedded_status.tsx +++ b/app/javascript/mastodon/features/notifications_v2/components/embedded_status.tsx @@ -19,6 +19,11 @@ import { useAppSelector, useAppDispatch } from 'mastodon/store'; import { EmbeddedStatusContent } from './embedded_status_content'; export type Mention = RecordOf<{ url: string; acct: string }>; +export type MediaAttachment = RecordOf<{ + id: string; + type: string; + description?: string; +}>; export const EmbeddedStatus: React.FC<{ statusId: string }> = ({ statusId, @@ -120,9 +125,14 @@ export const EmbeddedStatus: React.FC<{ statusId: string }> = ({ const language = status.get('language') as string; const mentions = status.get('mentions') as ImmutableList; const expanded = !status.get('hidden') || !contentWarning; - const mediaAttachmentsSize = ( - status.get('media_attachments') as ImmutableList - ).size; + const mediaAttachments = status.get( + 'media_attachments', + ) as ImmutableList; + const mediaAttachmentsWithDescription = mediaAttachments.filter( + (attachment) => !!attachment.get('description'), + ); + const uncaptionedMediaCount = + mediaAttachments.size - mediaAttachmentsWithDescription.size; return (
= ({ /> )} - {expanded && (poll || mediaAttachmentsSize > 0) && ( -
- {!!poll && ( - <> - - - - )} - {mediaAttachmentsSize > 0 && ( - <> - - - + {expanded && !!poll && ( +
+ + +
+ )} + + {expanded && + mediaAttachmentsWithDescription.size > 0 && + mediaAttachmentsWithDescription.map((attachment) => ( +
+ + {attachment.get('description')} +
+ ))} + + {expanded && uncaptionedMediaCount > 0 && ( +
+ + {mediaAttachmentsWithDescription.size > 0 ? ( + + ) : ( + )}
)} diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index cf5834835d..66d4acfcac 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -711,6 +711,7 @@ "relative_time.today": "today", "reply_indicator.attachments": "{count, plural, one {# attachment} other {# attachments}}", "reply_indicator.cancel": "Cancel", + "reply_indicator.other_attachments": "{count, plural, one {# other attachment} other {# other attachments}}", "reply_indicator.poll": "Poll", "report.block": "Block", "report.block_explanation": "You will not see their posts. They will not be able to see your posts or follow you. They will be able to tell that they are blocked.", diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index d21175595d..6481cbaeea 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -10446,6 +10446,12 @@ noscript { font-size: 15px; line-height: 22px; color: $dark-text-color; + + span { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } } } }