import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { NavLink } from 'react-router-dom'; import AttachmentThumbs from 'soapbox/components/attachment_thumbs'; import Avatar from 'soapbox/components/avatar'; import DisplayName from 'soapbox/components/display_name'; import IconButton from 'soapbox/components/icon_button'; import RelativeTimestamp from 'soapbox/components/relative_timestamp'; import { isRtl } from 'soapbox/rtl'; const messages = defineMessages({ cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' }, }); export default @injectIntl class QuotedStatus extends ImmutablePureComponent { static contextTypes = { router: PropTypes.object, }; static propTypes = { status: ImmutablePropTypes.map, onCancel: PropTypes.func, intl: PropTypes.object.isRequired, compose: PropTypes.bool, }; handleExpandClick = e => { const { compose, status } = this.props; if (!compose && e.button === 0) { if (!this.context.router) { return; } this.context.router.history.push(`/@${status.getIn(['account', 'acct'])}/posts/${status.get('id')}`); e.preventDefault(); } } handleClose = e => { this.props.onCancel(); e.preventDefault(); } renderReplyMentions = () => { const { status } = this.props; if (!status.get('in_reply_to_id')) { return null; } const to = status.get('mentions', []); if (to.size === 0) { if (status.get('in_reply_to_account_id') === status.getIn(['account', 'id'])) { return (