Fix account link in quote
This commit is contained in:
parent
70318ba219
commit
bfe472cf3b
@ -459,6 +459,136 @@ class Status extends ImmutablePureComponent {
|
||||
|
||||
const visibilityIcon = visibilityIconInfo[status.get('visibility')];
|
||||
|
||||
let quote = null;
|
||||
if (status.get('quote', null) !== null && typeof status.get('quote') === 'object') {
|
||||
let quote_status = status.get('quote');
|
||||
|
||||
let quote_media = null;
|
||||
if (quote_status.get('media_attachments').size > 0) {
|
||||
if (pictureInPicture.get('inUse')) {
|
||||
quote_media = <PictureInPicturePlaceholder width={this.props.cachedMediaWidth} />;
|
||||
} else if (this.props.muted) {
|
||||
quote_media = (
|
||||
<AttachmentList
|
||||
compact
|
||||
media={quote_status.get('media_attachments')}
|
||||
/>
|
||||
);
|
||||
} else if (quote_status.getIn(['media_attachments', 0, 'type']) === 'audio') {
|
||||
const attachment = quote_status.getIn(['media_attachments', 0]);
|
||||
|
||||
quote_media = (
|
||||
<Bundle fetchComponent={Audio} loading={this.renderLoadingAudioPlayer} >
|
||||
{Component => (
|
||||
<Component
|
||||
src={attachment.get('url')}
|
||||
alt={attachment.get('description')}
|
||||
poster={attachment.get('preview_url') || quote_status.getIn(['account', 'avatar_static'])}
|
||||
backgroundColor={attachment.getIn(['meta', 'colors', 'background'])}
|
||||
foregroundColor={attachment.getIn(['meta', 'colors', 'foreground'])}
|
||||
accentColor={attachment.getIn(['meta', 'colors', 'accent'])}
|
||||
duration={attachment.getIn(['meta', 'original', 'duration'], 0)}
|
||||
width={this.props.cachedMediaWidth}
|
||||
height={70}
|
||||
cacheWidth={this.props.cacheMediaWidth}
|
||||
deployPictureInPicture={pictureInPicture.get('available') ? this.handleDeployPictureInPicture : undefined}
|
||||
/>
|
||||
)}
|
||||
</Bundle>
|
||||
);
|
||||
} else if (quote_status.getIn(['media_attachments', 0, 'type']) === 'video') {
|
||||
const attachment = quote_status.getIn(['media_attachments', 0]);
|
||||
|
||||
quote_media = (
|
||||
<Bundle fetchComponent={Video} loading={this.renderLoadingVideoPlayer} >
|
||||
{Component => (
|
||||
<Component
|
||||
preview={attachment.get('preview_url')}
|
||||
frameRate={attachment.getIn(['meta', 'original', 'frame_rate'])}
|
||||
blurhash={attachment.get('blurhash')}
|
||||
src={attachment.get('url')}
|
||||
alt={attachment.get('description')}
|
||||
width={this.props.cachedMediaWidth}
|
||||
height={110}
|
||||
inline
|
||||
sensitive={quote_status.get('sensitive')}
|
||||
onOpenVideo={this.handleOpenVideoQuote}
|
||||
cacheWidth={this.props.cacheMediaWidth}
|
||||
deployPictureInPicture={pictureInPicture.get('available') ? this.handleDeployPictureInPicture : undefined}
|
||||
visible={this.state.showQuoteMedia}
|
||||
onToggleVisibility={this.handleToggleQuoteMediaVisibility}
|
||||
quote
|
||||
/>
|
||||
)}
|
||||
</Bundle>
|
||||
);
|
||||
} else {
|
||||
quote_media = (
|
||||
<Bundle fetchComponent={MediaGallery} loading={this.renderLoadingMediaGallery}>
|
||||
{Component => (
|
||||
<Component
|
||||
media={quote_status.get('media_attachments')}
|
||||
sensitive={quote_status.get('sensitive')}
|
||||
height={110}
|
||||
onOpenMedia={this.handleOpenMediaQuote}
|
||||
cacheWidth={this.props.cacheMediaWidth}
|
||||
defaultWidth={this.props.cachedMediaWidth}
|
||||
visible={this.state.showQuoteMedia}
|
||||
onToggleVisibility={this.handleToggleQuoteMediaVisibility}
|
||||
quote
|
||||
/>
|
||||
)}
|
||||
</Bundle>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (quote_muted) {
|
||||
quote = (
|
||||
<div className={classNames('quote-status', `status-${quote_status.get('visibility')}`, { muted: this.props.muted })} data-id={quote_status.get('id')}>
|
||||
<div className={classNames('status__content muted-quote', { 'status__content--with-action': this.context.router })}>
|
||||
<FormattedMessage id='status.muted_quote' defaultMessage='Muted quote' />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
} else if (quote_status.get('visibility') === 'unlisted' && !!contextType && ['public', 'community', 'hashtag'].includes(contextType.split(':', 2)[0])) {
|
||||
quote = (
|
||||
<div className={classNames('quote-status', `status-${quote_status.get('visibility')}`, { muted: this.props.muted })} data-id={quote_status.get('id')}>
|
||||
<div className={classNames('status__content unlisted-quote', { 'status__content--with-action': this.context.router })}>
|
||||
<button onClick={this.handleQuoteClick}>
|
||||
<FormattedMessage id='status.unlisted_quote' defaultMessage='Unlisted quote' />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
quote = (
|
||||
<div className={classNames('quote-status', `status-${quote_status.get('visibility')}`, { muted: this.props.muted })} data-id={quote_status.get('id')}>
|
||||
<div className='status__info'>
|
||||
<a onClick={this.handleAccountClick} target='_blank' data-id={quote_status.getIn(['account', 'id'])} data-group={quote_status.getIn(['account', 'group'])} href={quote_status.getIn(['account', 'url'])} title={quote_status.getIn(['account', 'acct'])} className='status__display-name'>
|
||||
<div className='status__avatar'><Avatar account={quote_status.get('account')} size={18} /></div>
|
||||
<DisplayName account={quote_status.get('account')} />
|
||||
</a>
|
||||
</div>
|
||||
<StatusContent status={quote_status} onClick={this.handleQuoteClick} expanded={!status.get('quote_hidden')} onExpandedToggle={this.handleExpandedQuoteToggle} quote />
|
||||
{quote_media}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
} else if (quote_muted) {
|
||||
quote = (
|
||||
<div className={classNames('quote-status', { muted: this.props.muted })}>
|
||||
<div className={classNames('status__content muted-quote', { 'status__content--with-action': this.context.router })}>
|
||||
<FormattedMessage id='status.muted_quote' defaultMessage='Muted quote' />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const expires_at = status.get('expires_at')
|
||||
const expires_date = expires_at && new Date(expires_at)
|
||||
const expired = expires_date && expires_date.getTime() < intl.now()
|
||||
|
||||
return (
|
||||
<HotKeys handlers={handlers}>
|
||||
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), unread, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef}>
|
||||
|
@ -54,8 +54,15 @@ class DetailedStatus extends ImmutablePureComponent {
|
||||
|
||||
handleAccountClick = (e) => {
|
||||
if (e.button === 0 && !(e.ctrlKey || e.metaKey) && this.context.router) {
|
||||
const id = e.currentTarget.getAttribute('data-id');
|
||||
const group = e.currentTarget.getAttribute('data-group') !== 'false';
|
||||
|
||||
e.preventDefault();
|
||||
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
|
||||
if (group) {
|
||||
this.context.router.history.push(`/timelines/groups/${id}`);
|
||||
} else {
|
||||
this.context.router.history.push(`/accounts/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
@ -121,6 +128,95 @@ class DetailedStatus extends ImmutablePureComponent {
|
||||
outerStyle.height = `${this.state.height}px`;
|
||||
}
|
||||
|
||||
let quote = null;
|
||||
if (status.get('quote', null) !== null) {
|
||||
let quote_status = status.get('quote');
|
||||
|
||||
let quote_media = null;
|
||||
if (quote_status.get('media_attachments').size > 0) {
|
||||
|
||||
if (quote_status.getIn(['media_attachments', 0, 'type']) === 'audio') {
|
||||
const attachment = quote_status.getIn(['media_attachments', 0]);
|
||||
|
||||
quote_media = (
|
||||
<Audio
|
||||
src={attachment.get('url')}
|
||||
alt={attachment.get('description')}
|
||||
duration={attachment.getIn(['meta', 'original', 'duration'], 0)}
|
||||
poster={attachment.get('preview_url') || quote_status.getIn(['account', 'avatar_static'])}
|
||||
backgroundColor={attachment.getIn(['meta', 'colors', 'background'])}
|
||||
foregroundColor={attachment.getIn(['meta', 'colors', 'foreground'])}
|
||||
accentColor={attachment.getIn(['meta', 'colors', 'accent'])}
|
||||
height={60}
|
||||
/>
|
||||
);
|
||||
} else if (quote_status.getIn(['media_attachments', 0, 'type']) === 'video') {
|
||||
const attachment = quote_status.getIn(['media_attachments', 0]);
|
||||
|
||||
quote_media = (
|
||||
<Video
|
||||
preview={attachment.get('preview_url')}
|
||||
frameRate={attachment.getIn(['meta', 'original', 'frame_rate'])}
|
||||
blurhash={attachment.get('blurhash')}
|
||||
src={attachment.get('url')}
|
||||
alt={attachment.get('description')}
|
||||
width={300}
|
||||
height={150}
|
||||
inline
|
||||
onOpenVideo={this.handleOpenVideoQuote}
|
||||
sensitive={quote_status.get('sensitive')}
|
||||
visible={this.props.showQuoteMedia}
|
||||
onToggleVisibility={this.props.onToggleQuoteMediaVisibility}
|
||||
quote
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
quote_media = (
|
||||
<MediaGallery
|
||||
standalone
|
||||
sensitive={quote_status.get('sensitive')}
|
||||
media={quote_status.get('media_attachments')}
|
||||
height={300}
|
||||
onOpenMedia={this.props.onOpenMediaQuote}
|
||||
visible={this.props.showQuoteMedia}
|
||||
onToggleVisibility={this.props.onToggleQuoteMediaVisibility}
|
||||
quote
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (quote_muted) {
|
||||
quote = (
|
||||
<div className='quote-status' data-id={quote_status.get('id')} dataurl={quote_status.get('url')}>
|
||||
<div className='status__content muted-quote'>
|
||||
<FormattedMessage id='status.muted_quote' defaultMessage='Muted quote' />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
quote = (
|
||||
<div className='quote-status' data-id={quote_status.get('id')} dataurl={quote_status.get('url')}>
|
||||
<a href={quote_status.getIn(['account', 'url'])} onClick={this.handleAccountClick} data-id={quote_status.getIn(['account', 'id'])} data-group={quote_status.getIn(['account', 'group'])} className='detailed-status__display-name'>
|
||||
<div className='detailed-status__display-avatar'><Avatar account={quote_status.get('account')} size={18} /></div>
|
||||
<DisplayName account={quote_status.get('account')} localDomain={this.props.domain} />
|
||||
</a>
|
||||
|
||||
<StatusContent status={quote_status} onClick={this.handleQuoteClick} expanded={!status.get('quote_hidden')} onExpandedToggle={this.handleExpandedQuoteToggle} quote />
|
||||
{quote_media}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
} else if (quote_muted) {
|
||||
quote = (
|
||||
<div className={classNames('quote-status', { muted: this.props.muted })} data-id={quote_status.get('id')} dataurl={quote_status.get('url')}>
|
||||
<div className={classNames('status__content muted-quote', { 'status__content--with-action': this.context.router })}>
|
||||
<FormattedMessage id='status.muted_quote' defaultMessage='Muted quote' />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (pictureInPicture.get('inUse')) {
|
||||
media = <PictureInPicturePlaceholder />;
|
||||
} else if (status.get('media_attachments').size > 0) {
|
||||
@ -239,8 +335,8 @@ class DetailedStatus extends ImmutablePureComponent {
|
||||
|
||||
return (
|
||||
<div style={outerStyle}>
|
||||
<div ref={this.setRef} className={classNames('detailed-status', `detailed-status-${status.get('visibility')}`, { compact })}>
|
||||
<a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='detailed-status__display-name'>
|
||||
<div ref={this.setRef} className={classNames('detailed-status', `detailed-status-${status.get('visibility')}`, { compact, 'detailed-status-with-expiration': expires_date, 'detailed-status-expired': expired })}>
|
||||
<a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} data-id={status.getIn(['account', 'id'])} data-group={status.getIn(['account', 'group'])} className='detailed-status__display-name'>
|
||||
<div className='detailed-status__display-avatar'><Avatar account={status.get('account')} size={48} /></div>
|
||||
<DisplayName account={status.get('account')} localDomain={this.props.domain} />
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user