import { Fragment } from 'react' import { NavLink } from 'react-router-dom' import { defineMessages, injectIntl } from 'react-intl' import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import Button from './button' import DisplayName from './display_name' import DotTextSeperator from './dot_text_seperator' import Icon from './icon' import RelativeTimestamp from './relative_timestamp' import Text from './text' const messages = defineMessages({ edited: { id: 'status.edited', defaultMessage: 'Edited' }, likesLabel: { id: 'likes.label', defaultMessage: '{number, plural, one {# like} other {# likes}}' }, repostsLabel: { id: 'reposts.label', defaultMessage: '{number, plural, one {# repost} other {# reposts}}' }, original: { id: 'original_gabber', defaultMessage: 'Original Gabber' }, }) export default @injectIntl class CommentHeader extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, ancestorAccountId: PropTypes.string.isRequired, status: ImmutablePropTypes.map.isRequired, onOpenLikes: PropTypes.func.isRequired, onOpenReposts: PropTypes.func.isRequired, onOpenRevisions: PropTypes.func.isRequired, } openLikesList = () => { this.props.onOpenLikes(this.props.status) } openRepostsList = () => { this.props.onOpenReposts(this.props.status) } openRevisions = () => { this.props.onOpenRevisions(this.props.status) } render() { const { intl, status, ancestorAccountId, } = this.props if (!status) return null const repostCount = status.get('reblogs_count') const favoriteCount = status.get('favourites_count') const statusUrl = `/${status.getIn(['account', 'acct'])}/posts/${status.get('id')}`; const isOwner = ancestorAccountId === status.getIn(['account', 'id']) return (
{ isOwner &&
{intl.formatMessage(messages.original)}
} { !!status.get('group') && } { status.get('revised_at') !== null && } { favoriteCount > 0 && } { repostCount > 0 && }
) } }