import PropTypes from 'prop-types'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { AvatarOverlay } from 'mastodon/components/avatar_overlay'; import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; // This needs to be kept in sync with app/models/report.rb const messages = defineMessages({ openReport: { id: 'report_notification.open', defaultMessage: 'Open report' }, other: { id: 'report_notification.categories.other', defaultMessage: 'Other' }, spam: { id: 'report_notification.categories.spam', defaultMessage: 'Spam' }, legal: { id: 'report_notification.categories.legal', defaultMessage: 'Legal' }, violation: { id: 'report_notification.categories.violation', defaultMessage: 'Rule violation' }, }); class Report extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.record.isRequired, report: ImmutablePropTypes.map.isRequired, hidden: PropTypes.bool, intl: PropTypes.object.isRequired, }; render () { const { intl, hidden, report, account } = this.props; if (!report) { return null; } if (hidden) { return ( <> {report.get('id')} ); } return (
ยท
{intl.formatMessage(messages[report.get('category')])}
{intl.formatMessage(messages.openReport)}
); } } export default injectIntl(Report);