mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-28 20:47:10 +00:00
Merge e3d9b4405b
into fbe9728f36
This commit is contained in:
commit
23cda04eea
|
@ -18,6 +18,11 @@ import { useAppSelector, useAppDispatch } from 'mastodon/store';
|
||||||
import { EmbeddedStatusContent } from './embedded_status_content';
|
import { EmbeddedStatusContent } from './embedded_status_content';
|
||||||
|
|
||||||
export type Mention = RecordOf<{ url: string; acct: string }>;
|
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 }> = ({
|
export const EmbeddedStatus: React.FC<{ statusId: string }> = ({
|
||||||
statusId,
|
statusId,
|
||||||
|
@ -117,9 +122,14 @@ export const EmbeddedStatus: React.FC<{ statusId: string }> = ({
|
||||||
const language = status.get('language') as string;
|
const language = status.get('language') as string;
|
||||||
const mentions = status.get('mentions') as ImmutableList<Mention>;
|
const mentions = status.get('mentions') as ImmutableList<Mention>;
|
||||||
const expanded = !status.get('hidden') || !contentWarning;
|
const expanded = !status.get('hidden') || !contentWarning;
|
||||||
const mediaAttachmentsSize = (
|
const mediaAttachments = status.get(
|
||||||
status.get('media_attachments') as ImmutableList<unknown>
|
'media_attachments',
|
||||||
).size;
|
) as ImmutableList<MediaAttachment>;
|
||||||
|
const mediaAttachmentsWithDescription = mediaAttachments.filter(
|
||||||
|
(attachment) => !!attachment.get('description'),
|
||||||
|
);
|
||||||
|
const uncaptionedMediaCount =
|
||||||
|
mediaAttachments.size - mediaAttachmentsWithDescription.size;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@ -153,26 +163,46 @@ export const EmbeddedStatus: React.FC<{ statusId: string }> = ({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{expanded && (poll || mediaAttachmentsSize > 0) && (
|
{expanded && !!poll && (
|
||||||
<div className='notification-group__embedded-status__attachments reply-indicator__attachments'>
|
<div
|
||||||
{!!poll && (
|
className='notification-group__embedded-status__attachments reply-indicator__attachments'
|
||||||
<>
|
key='poll-indicator'
|
||||||
|
>
|
||||||
<Icon icon={BarChart4BarsIcon} id='bar-chart-4-bars' />
|
<Icon icon={BarChart4BarsIcon} id='bar-chart-4-bars' />
|
||||||
<FormattedMessage
|
<FormattedMessage id='reply_indicator.poll' defaultMessage='Poll' />
|
||||||
id='reply_indicator.poll'
|
</div>
|
||||||
defaultMessage='Poll'
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
{mediaAttachmentsSize > 0 && (
|
|
||||||
<>
|
{expanded &&
|
||||||
|
mediaAttachmentsWithDescription.size > 0 &&
|
||||||
|
mediaAttachmentsWithDescription.map((attachment) => (
|
||||||
|
<div
|
||||||
|
className='notification-group__embedded-status__attachments reply-indicator__attachments'
|
||||||
|
key={`media-description-${attachment.get('id')}}`}
|
||||||
|
>
|
||||||
<Icon icon={PhotoLibraryIcon} id='photo-library' />
|
<Icon icon={PhotoLibraryIcon} id='photo-library' />
|
||||||
|
<span>{attachment.get('description')}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{expanded && uncaptionedMediaCount > 0 && (
|
||||||
|
<div
|
||||||
|
className='notification-group__embedded-status__attachments reply-indicator__attachments'
|
||||||
|
key='uncaptioned-media-indicator'
|
||||||
|
>
|
||||||
|
<Icon icon={PhotoLibraryIcon} id='photo-library' />
|
||||||
|
{mediaAttachmentsWithDescription.size > 0 ? (
|
||||||
|
<FormattedMessage
|
||||||
|
id='reply_indicator.other_attachments'
|
||||||
|
defaultMessage='{count, plural, one {# other attachment} other {# other attachments}}'
|
||||||
|
values={{ count: uncaptionedMediaCount }}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='reply_indicator.attachments'
|
id='reply_indicator.attachments'
|
||||||
defaultMessage='{count, plural, one {# attachment} other {# attachments}}'
|
defaultMessage='{count, plural, one {# attachment} other {# attachments}}'
|
||||||
values={{ count: mediaAttachmentsSize }}
|
values={{ count: uncaptionedMediaCount }}
|
||||||
/>
|
/>
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -744,6 +744,7 @@
|
||||||
"relative_time.today": "today",
|
"relative_time.today": "today",
|
||||||
"reply_indicator.attachments": "{count, plural, one {# attachment} other {# attachments}}",
|
"reply_indicator.attachments": "{count, plural, one {# attachment} other {# attachments}}",
|
||||||
"reply_indicator.cancel": "Cancel",
|
"reply_indicator.cancel": "Cancel",
|
||||||
|
"reply_indicator.other_attachments": "{count, plural, one {# other attachment} other {# other attachments}}",
|
||||||
"reply_indicator.poll": "Poll",
|
"reply_indicator.poll": "Poll",
|
||||||
"report.block": "Block",
|
"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.",
|
"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.",
|
||||||
|
|
|
@ -10500,6 +10500,12 @@ noscript {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
color: $dark-text-color;
|
color: $dark-text-color;
|
||||||
|
|
||||||
|
span {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user