Skip to content

Commit

Permalink
Add local_only indicator to detailed status
Browse files Browse the repository at this point in the history
  • Loading branch information
renatolond committed Aug 26, 2018
1 parent 83982ab commit 452ad73
Showing 1 changed file with 13 additions and 2 deletions.
Expand Up @@ -7,11 +7,16 @@ import StatusContent from '../../../components/status_content';
import MediaGallery from '../../../components/media_gallery';
import AttachmentList from '../../../components/attachment_list';
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 ImmutablePureComponent from 'react-immutable-pure-component';
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 {

static contextTypes = {
Expand Down Expand Up @@ -44,10 +49,12 @@ export default class DetailedStatus extends ImmutablePureComponent {

render () {
const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status;
const intl = this.props.intl;

let media = '';
let applicationLink = '';
let reblogLink = '';
let localOnly = '';
let reblogIcon = 'retweet';

if (status.get('media_attachments').size > 0) {
Expand Down Expand Up @@ -104,6 +111,10 @@ export default class DetailedStatus extends ImmutablePureComponent {
</Link>);
}

if(status.get('local_only')) {
localOnly = <span> · <i className='fa fa-chain-broken' title={intl.formatMessage(messages.local_only)} /></span>;
}

return (
<div className='detailed-status'>
<a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='detailed-status__display-name'>
Expand All @@ -123,7 +134,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
<span className='detailed-status__favorites'>
<FormattedNumber value={status.get('favourites_count')} />
</span>
</Link>
</Link>{localOnly}
</div>
</div>
);
Expand Down

0 comments on commit 452ad73

Please sign in to comment.