diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-07 08:28:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-07 08:28:52 +0100 |
commit | cfa9b6e13ab3c434f3901df6f614d0aa94a3d1ed (patch) | |
tree | e303778680cdd80ad5a31ec5fb3b28ba5dc834ef /app/javascript/mastodon/features | |
parent | e26d5ca923353c9cd61073c444c0841bae4b9664 (diff) |
Remove text requirement when media attached from statuses (#6672)
Diffstat (limited to 'app/javascript/mastodon/features')
-rw-r--r-- | app/javascript/mastodon/features/compose/components/compose_form.js | 7 | ||||
-rw-r--r-- | app/javascript/mastodon/features/compose/containers/compose_form_container.js | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index a876c5197..663ccfb8e 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -50,6 +50,7 @@ export default class ComposeForm extends ImmutablePureComponent { onPaste: PropTypes.func.isRequired, onPickEmoji: PropTypes.func.isRequired, showSearch: PropTypes.bool, + anyMedia: PropTypes.bool, }; static defaultProps = { @@ -142,10 +143,10 @@ export default class ComposeForm extends ImmutablePureComponent { } render () { - const { intl, onPaste, showSearch } = this.props; + const { intl, onPaste, showSearch, anyMedia } = this.props; const disabled = this.props.is_submitting; const text = [this.props.spoiler_text, countableText(this.props.text)].join(''); - + const disabledButton = disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia); let publishText = ''; if (this.props.privacy === 'private' || this.props.privacy === 'direct') { @@ -203,7 +204,7 @@ export default class ComposeForm extends ImmutablePureComponent { </div> <div className='compose-form__publish'> - <div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0)} block /></div> + <div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabledButton} block /></div> </div> </div> ); diff --git a/app/javascript/mastodon/features/compose/containers/compose_form_container.js b/app/javascript/mastodon/features/compose/containers/compose_form_container.js index 5f5509dbe..ede23d361 100644 --- a/app/javascript/mastodon/features/compose/containers/compose_form_container.js +++ b/app/javascript/mastodon/features/compose/containers/compose_form_container.js @@ -23,6 +23,7 @@ const mapStateToProps = state => ({ is_submitting: state.getIn(['compose', 'is_submitting']), is_uploading: state.getIn(['compose', 'is_uploading']), showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']), + anyMedia: state.getIn(['compose', 'media_attachments']).size > 0, }); const mapDispatchToProps = (dispatch) => ({ |