Add local_only indicator to detailed status

This commit is contained in:
Renato "Lond" Cerqueira 2018-08-24 19:27:12 +02:00
parent c963e1548d
commit b4ae56e82f

View File

@ -7,11 +7,16 @@ import StatusContent from '../../../components/status_content';
import MediaGallery from '../../../components/media_gallery'; import MediaGallery from '../../../components/media_gallery';
import AttachmentList from '../../../components/attachment_list'; import AttachmentList from '../../../components/attachment_list';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { FormattedDate, FormattedNumber } from 'react-intl'; import { defineMessages, injectIntl, FormattedDate, FormattedNumber } from 'react-intl';
import CardContainer from '../containers/card_container'; import CardContainer from '../containers/card_container';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import Video from '../../video'; import Video from '../../video';
const messages = defineMessages({
local_only: { id: 'status.local_only', defaultMessage: 'This post is only visible by other users of your instance' },
});
@injectIntl
export default class DetailedStatus extends ImmutablePureComponent { export default class DetailedStatus extends ImmutablePureComponent {
static contextTypes = { static contextTypes = {
@ -44,10 +49,12 @@ export default class DetailedStatus extends ImmutablePureComponent {
render () { render () {
const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status; const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status;
const intl = this.props.intl;
let media = ''; let media = '';
let applicationLink = ''; let applicationLink = '';
let reblogLink = ''; let reblogLink = '';
let localOnly = '';
let reblogIcon = 'retweet'; let reblogIcon = 'retweet';
if (status.get('media_attachments').size > 0) { if (status.get('media_attachments').size > 0) {
@ -104,6 +111,10 @@ export default class DetailedStatus extends ImmutablePureComponent {
</Link>); </Link>);
} }
if(status.get('local_only')) {
localOnly = <span> · <i className='fa fa-chain-broken' title={intl.formatMessage(messages.local_only)} /></span>;
}
return ( return (
<div className='detailed-status'> <div className='detailed-status'>
<a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='detailed-status__display-name'> <a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='detailed-status__display-name'>
@ -123,7 +134,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
<span className='detailed-status__favorites'> <span className='detailed-status__favorites'>
<FormattedNumber value={status.get('favourites_count')} /> <FormattedNumber value={status.get('favourites_count')} />
</span> </span>
</Link> </Link>{localOnly}
</div> </div>
</div> </div>
); );