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 f63d42f826..95cad1d06e 100644 --- a/app/javascript/mastodon/features/notifications_v2/components/embedded_status.tsx +++ b/app/javascript/mastodon/features/notifications_v2/components/embedded_status.tsx @@ -18,6 +18,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, @@ -117,9 +122,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 3d6e166498..357ef69241 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -744,6 +744,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 e22a9ed9c9..e44f345106 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -10500,6 +10500,12 @@ noscript { font-size: 15px; line-height: 22px; color: $dark-text-color; + + span { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } } } }