|
|
@ -3,6 +3,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; |
|
|
|
import PropTypes from 'prop-types'; |
|
|
|
import Avatar from './avatar'; |
|
|
|
import AvatarOverlay from './avatar_overlay'; |
|
|
|
import AvatarComposite from './avatar_composite'; |
|
|
|
import RelativeTimestamp from './relative_timestamp'; |
|
|
|
import DisplayName from './display_name'; |
|
|
|
import StatusContent from './status_content'; |
|
|
@ -45,6 +46,8 @@ class Status extends ImmutablePureComponent { |
|
|
|
static propTypes = { |
|
|
|
status: ImmutablePropTypes.map, |
|
|
|
account: ImmutablePropTypes.map, |
|
|
|
otherAccounts: ImmutablePropTypes.list, |
|
|
|
onClick: PropTypes.func, |
|
|
|
onReply: PropTypes.func, |
|
|
|
onFavourite: PropTypes.func, |
|
|
|
onReblog: PropTypes.func, |
|
|
@ -60,6 +63,7 @@ class Status extends ImmutablePureComponent { |
|
|
|
onToggleHidden: PropTypes.func, |
|
|
|
muted: PropTypes.bool, |
|
|
|
hidden: PropTypes.bool, |
|
|
|
unread: PropTypes.bool, |
|
|
|
onMoveUp: PropTypes.func, |
|
|
|
onMoveDown: PropTypes.func, |
|
|
|
}; |
|
|
@ -74,6 +78,11 @@ class Status extends ImmutablePureComponent { |
|
|
|
] |
|
|
|
|
|
|
|
handleClick = () => { |
|
|
|
if (this.props.onClick) { |
|
|
|
this.props.onClick(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.context.router) { |
|
|
|
return; |
|
|
|
} |
|
|
@ -158,7 +167,7 @@ class Status extends ImmutablePureComponent { |
|
|
|
let media = null; |
|
|
|
let statusAvatar, prepend, rebloggedByText; |
|
|
|
|
|
|
|
const { intl, hidden, featured } = this.props; |
|
|
|
const { intl, hidden, featured, otherAccounts, unread } = this.props; |
|
|
|
|
|
|
|
let { status, account, ...other } = this.props; |
|
|
|
|
|
|
@ -249,9 +258,11 @@ class Status extends ImmutablePureComponent { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (account === undefined || account === null) { |
|
|
|
if (otherAccounts) { |
|
|
|
statusAvatar = <AvatarComposite accounts={otherAccounts} size={48} />; |
|
|
|
} else if (account === undefined || account === null) { |
|
|
|
statusAvatar = <Avatar account={status.get('account')} size={48} />; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
statusAvatar = <AvatarOverlay account={status.get('account')} friend={account} />; |
|
|
|
} |
|
|
|
|
|
|
@ -269,10 +280,10 @@ class Status extends ImmutablePureComponent { |
|
|
|
|
|
|
|
return ( |
|
|
|
<HotKeys handlers={handlers}> |
|
|
|
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText, !status.get('hidden'))}> |
|
|
|
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), read: unread === false, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText, !status.get('hidden'))}> |
|
|
|
{prepend} |
|
|
|
|
|
|
|
<div className={classNames('status', `status-${status.get('visibility')}`, { 'status-reply': !!status.get('in_reply_to_id'), muted: this.props.muted })} data-id={status.get('id')}> |
|
|
|
<div className={classNames('status', `status-${status.get('visibility')}`, { 'status-reply': !!status.get('in_reply_to_id'), muted: this.props.muted, read: unread === false })} data-id={status.get('id')}> |
|
|
|
<div className='status__info'> |
|
|
|
<a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'><RelativeTimestamp timestamp={status.get('created_at')} /></a> |
|
|
|
|
|
|
@ -281,7 +292,7 @@ class Status extends ImmutablePureComponent { |
|
|
|
{statusAvatar} |
|
|
|
</div> |
|
|
|
|
|
|
|
<DisplayName account={status.get('account')} /> |
|
|
|
<DisplayName account={status.get('account')} others={otherAccounts} /> |
|
|
|
</a> |
|
|
|
</div> |
|
|
|
|
|
|
|