|
|
@ -26,12 +26,18 @@ import StatusHeader from './status_header';
|
|
|
|
import StatusIcons from './status_icons';
|
|
|
|
import StatusIcons from './status_icons';
|
|
|
|
import StatusPrepend from './status_prepend';
|
|
|
|
import StatusPrepend from './status_prepend';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const domParser = new DOMParser();
|
|
|
|
|
|
|
|
|
|
|
|
export const textForScreenReader = (intl, status, rebloggedByText = false, expanded = false) => {
|
|
|
|
export const textForScreenReader = (intl, status, rebloggedByText = false, expanded = false) => {
|
|
|
|
const displayName = status.getIn(['account', 'display_name']);
|
|
|
|
const displayName = status.getIn(['account', 'display_name']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const spoilerText = status.getIn(['translation', 'spoiler_text']) || status.get('spoiler_text');
|
|
|
|
|
|
|
|
const contentHtml = status.getIn(['translation', 'contentHtml']) || status.get('contentHtml');
|
|
|
|
|
|
|
|
const contentText = domParser.parseFromString(contentHtml, 'text/html').documentElement.textContent;
|
|
|
|
|
|
|
|
|
|
|
|
const values = [
|
|
|
|
const values = [
|
|
|
|
displayName.length === 0 ? status.getIn(['account', 'acct']).split('@')[0] : displayName,
|
|
|
|
displayName.length === 0 ? status.getIn(['account', 'acct']).split('@')[0] : displayName,
|
|
|
|
status.get('spoiler_text') && !expanded ? status.get('spoiler_text') : status.get('search_index').slice(status.get('spoiler_text').length),
|
|
|
|
spoilerText && !expanded ? spoilerText : contentText,
|
|
|
|
intl.formatDate(status.get('created_at'), { hour: '2-digit', minute: '2-digit', month: 'short', day: 'numeric' }),
|
|
|
|
intl.formatDate(status.get('created_at'), { hour: '2-digit', minute: '2-digit', month: 'short', day: 'numeric' }),
|
|
|
|
status.getIn(['account', 'acct']),
|
|
|
|
status.getIn(['account', 'acct']),
|
|
|
|
];
|
|
|
|
];
|
|
|
@ -391,12 +397,14 @@ class Status extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
handleOpenVideo = (options) => {
|
|
|
|
handleOpenVideo = (options) => {
|
|
|
|
const { status } = this.props;
|
|
|
|
const { status } = this.props;
|
|
|
|
this.props.onOpenVideo(status.get('id'), status.getIn(['media_attachments', 0]), status.get('language'), options);
|
|
|
|
const lang = status.getIn(['translation', 'language']) || status.get('language');
|
|
|
|
|
|
|
|
this.props.onOpenVideo(status.get('id'), status.getIn(['media_attachments', 0]), lang, options);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
handleOpenMedia = (media, index) => {
|
|
|
|
handleOpenMedia = (media, index) => {
|
|
|
|
const { status } = this.props;
|
|
|
|
const { status } = this.props;
|
|
|
|
this.props.onOpenMedia(status.get('id'), media, index, status.get('language'));
|
|
|
|
const lang = status.getIn(['translation', 'language']) || status.get('language');
|
|
|
|
|
|
|
|
this.props.onOpenMedia(status.get('id'), media, index, lang);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
handleHotkeyOpenMedia = e => {
|
|
|
|
handleHotkeyOpenMedia = e => {
|
|
|
@ -406,10 +414,11 @@ class Status extends ImmutablePureComponent {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
if (status.get('media_attachments').size > 0) {
|
|
|
|
if (status.get('media_attachments').size > 0) {
|
|
|
|
|
|
|
|
const lang = status.getIn(['translation', 'language']) || status.get('language');
|
|
|
|
if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
|
|
|
|
if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
|
|
|
|
onOpenVideo(statusId, status.getIn(['media_attachments', 0]), { startTime: 0 });
|
|
|
|
onOpenVideo(statusId, status.getIn(['media_attachments', 0]), lang, { startTime: 0 });
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
onOpenMedia(statusId, status.get('media_attachments'), 0);
|
|
|
|
onOpenMedia(statusId, status.get('media_attachments'), 0, lang);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -625,6 +634,8 @@ class Status extends ImmutablePureComponent {
|
|
|
|
media.push(<PictureInPicturePlaceholder />);
|
|
|
|
media.push(<PictureInPicturePlaceholder />);
|
|
|
|
mediaIcons.push('video-camera');
|
|
|
|
mediaIcons.push('video-camera');
|
|
|
|
} else if (attachments.size > 0) {
|
|
|
|
} else if (attachments.size > 0) {
|
|
|
|
|
|
|
|
const language = status.getIn(['translation', 'language']) || status.get('language');
|
|
|
|
|
|
|
|
|
|
|
|
if (muted || attachments.some(item => item.get('type') === 'unknown')) {
|
|
|
|
if (muted || attachments.some(item => item.get('type') === 'unknown')) {
|
|
|
|
media.push(
|
|
|
|
media.push(
|
|
|
|
<AttachmentList
|
|
|
|
<AttachmentList
|
|
|
@ -634,14 +645,15 @@ class Status extends ImmutablePureComponent {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else if (attachments.getIn([0, 'type']) === 'audio') {
|
|
|
|
} else if (attachments.getIn([0, 'type']) === 'audio') {
|
|
|
|
const attachment = status.getIn(['media_attachments', 0]);
|
|
|
|
const attachment = status.getIn(['media_attachments', 0]);
|
|
|
|
|
|
|
|
const description = attachment.getIn(['translation', 'description']) || attachment.get('description');
|
|
|
|
|
|
|
|
|
|
|
|
media.push(
|
|
|
|
media.push(
|
|
|
|
<Bundle fetchComponent={Audio} loading={this.renderLoadingAudioPlayer} >
|
|
|
|
<Bundle fetchComponent={Audio} loading={this.renderLoadingAudioPlayer} >
|
|
|
|
{Component => (
|
|
|
|
{Component => (
|
|
|
|
<Component
|
|
|
|
<Component
|
|
|
|
src={attachment.get('url')}
|
|
|
|
src={attachment.get('url')}
|
|
|
|
alt={attachment.get('description')}
|
|
|
|
alt={description}
|
|
|
|
lang={status.get('language')}
|
|
|
|
lang={language}
|
|
|
|
poster={attachment.get('preview_url') || status.getIn(['account', 'avatar_static'])}
|
|
|
|
poster={attachment.get('preview_url') || status.getIn(['account', 'avatar_static'])}
|
|
|
|
backgroundColor={attachment.getIn(['meta', 'colors', 'background'])}
|
|
|
|
backgroundColor={attachment.getIn(['meta', 'colors', 'background'])}
|
|
|
|
foregroundColor={attachment.getIn(['meta', 'colors', 'foreground'])}
|
|
|
|
foregroundColor={attachment.getIn(['meta', 'colors', 'foreground'])}
|
|
|
@ -662,6 +674,7 @@ class Status extends ImmutablePureComponent {
|
|
|
|
mediaIcons.push('music');
|
|
|
|
mediaIcons.push('music');
|
|
|
|
} else if (attachments.getIn([0, 'type']) === 'video') {
|
|
|
|
} else if (attachments.getIn([0, 'type']) === 'video') {
|
|
|
|
const attachment = status.getIn(['media_attachments', 0]);
|
|
|
|
const attachment = status.getIn(['media_attachments', 0]);
|
|
|
|
|
|
|
|
const description = attachment.getIn(['translation', 'description']) || attachment.get('description');
|
|
|
|
|
|
|
|
|
|
|
|
media.push(
|
|
|
|
media.push(
|
|
|
|
<Bundle fetchComponent={Video} loading={this.renderLoadingVideoPlayer} >
|
|
|
|
<Bundle fetchComponent={Video} loading={this.renderLoadingVideoPlayer} >
|
|
|
@ -670,8 +683,8 @@ class Status extends ImmutablePureComponent {
|
|
|
|
frameRate={attachment.getIn(['meta', 'original', 'frame_rate'])}
|
|
|
|
frameRate={attachment.getIn(['meta', 'original', 'frame_rate'])}
|
|
|
|
blurhash={attachment.get('blurhash')}
|
|
|
|
blurhash={attachment.get('blurhash')}
|
|
|
|
src={attachment.get('url')}
|
|
|
|
src={attachment.get('url')}
|
|
|
|
alt={attachment.get('description')}
|
|
|
|
alt={description}
|
|
|
|
lang={status.get('language')}
|
|
|
|
lang={language}
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
sensitive={status.get('sensitive')}
|
|
|
|
sensitive={status.get('sensitive')}
|
|
|
|
letterbox={settings.getIn(['media', 'letterbox'])}
|
|
|
|
letterbox={settings.getIn(['media', 'letterbox'])}
|
|
|
@ -691,7 +704,7 @@ class Status extends ImmutablePureComponent {
|
|
|
|
{Component => (
|
|
|
|
{Component => (
|
|
|
|
<Component
|
|
|
|
<Component
|
|
|
|
media={attachments}
|
|
|
|
media={attachments}
|
|
|
|
lang={status.get('language')}
|
|
|
|
lang={language}
|
|
|
|
sensitive={status.get('sensitive')}
|
|
|
|
sensitive={status.get('sensitive')}
|
|
|
|
letterbox={settings.getIn(['media', 'letterbox'])}
|
|
|
|
letterbox={settings.getIn(['media', 'letterbox'])}
|
|
|
|
fullwidth={!rootId && settings.getIn(['media', 'fullwidth'])}
|
|
|
|
fullwidth={!rootId && settings.getIn(['media', 'fullwidth'])}
|
|
|
@ -724,7 +737,8 @@ class Status extends ImmutablePureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (status.get('poll')) {
|
|
|
|
if (status.get('poll')) {
|
|
|
|
contentMedia.push(<PollContainer pollId={status.get('poll')} lang={status.get('language')} />);
|
|
|
|
const language = status.getIn(['translation', 'language']) || status.get('language');
|
|
|
|
|
|
|
|
contentMedia.push(<PollContainer pollId={status.get('poll')} lang={language} />);
|
|
|
|
contentMediaIcons.push('tasks');
|
|
|
|
contentMediaIcons.push('tasks');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|