import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { FormattedMessage, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import { openModal } from 'soapbox/actions/modals'; import HoverRefWrapper from 'soapbox/components/hover_ref_wrapper'; const mapDispatchToProps = (dispatch) => ({ onOpenMentionsModal(username, statusId) { dispatch(openModal('MENTIONS', { username, statusId, })); }, }); export default @connect(null, mapDispatchToProps) @injectIntl class StatusReplyMentions extends ImmutablePureComponent { static propTypes = { status: ImmutablePropTypes.record.isRequired, onOpenMentionsModal: PropTypes.func, } handleOpenMentionsModal = (e) => { const { status, onOpenMentionsModal } = this.props; e.stopPropagation(); onOpenMentionsModal(status.getIn(['account', 'acct']), status.get('id')); } render() { const { status } = this.props; if (!status.get('in_reply_to_id')) { return null; } const to = status.get('mentions', []); // The post is a reply, but it has no mentions. // Rare, but it can happen. if (to.size === 0) { return (