Fix intl warning with disabled secondary toot btn

- Moved building the secondary btn text into the if to avoid trying to translate 'none' visibility
This commit is contained in:
Ondřej Hruška 2017-09-23 23:41:25 +02:00
parent 1924a71b5a
commit 210e6776fc
No known key found for this signature in database
GPG key ID: 2C5FD5035250423D

View file

@ -170,6 +170,7 @@ export default class ComposeForm extends ImmutablePureComponent {
let showSideArm = secondaryVisibility !== 'none'; let showSideArm = secondaryVisibility !== 'none';
let publishText = ''; let publishText = '';
let publishText2 = '';
const privacyIcons = { const privacyIcons = {
none: '', none: '',
@ -195,6 +196,13 @@ export default class ComposeForm extends ImmutablePureComponent {
} }
</span> </span>
); );
publishText2 = (
<i
className={`fa fa-${privacyIcons[secondaryVisibility]}`}
aria-label={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage({ id: `privacy.${secondaryVisibility}.short` })}`}
/>
);
} else { } else {
if (this.props.privacy === 'private' || this.props.privacy === 'direct') { if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
publishText = <span className='compose-form__publish-private'><i className='fa fa-lock' /> {intl.formatMessage(messages.publish)}</span>; publishText = <span className='compose-form__publish-private'><i className='fa fa-lock' /> {intl.formatMessage(messages.publish)}</span>;
@ -203,14 +211,6 @@ export default class ComposeForm extends ImmutablePureComponent {
} }
} }
// side-arm
let publishText2 = (
<i
className={`fa fa-${privacyIcons[secondaryVisibility]}`}
aria-label={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage({ id: `privacy.${secondaryVisibility}.short` })}`}
/>
);
const submitDisabled = disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0); const submitDisabled = disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0);
return ( return (
@ -271,8 +271,7 @@ export default class ComposeForm extends ImmutablePureComponent {
text={publishText2} text={publishText2}
onClick={this.handleSubmit2} onClick={this.handleSubmit2}
disabled={submitDisabled} disabled={submitDisabled}
/> : /> : ''
''
} }
<Button <Button
className='compose-form__publish__primary' className='compose-form__publish__primary'