From 38845592c4b4456b5b407bd320249613a0f16e13 Mon Sep 17 00:00:00 2001 From: Claire Date: Sat, 12 Feb 2022 19:00:33 +0100 Subject: [PATCH] Fix controls for unchangeable properties on status edit not being disabled (#17531) Fixes #17520 --- .../mastodon/features/compose/components/compose_form.js | 2 +- .../mastodon/features/compose/components/privacy_dropdown.js | 4 +++- .../mastodon/features/compose/components/upload.js | 5 +++-- .../mastodon/features/compose/containers/upload_container.js | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index f2cfaba4e..d75145a09 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -259,7 +259,7 @@ class ComposeForm extends ImmutablePureComponent {
- +
diff --git a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js index df59f46b3..599467cdb 100644 --- a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js +++ b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js @@ -159,6 +159,7 @@ class PrivacyDropdown extends React.PureComponent { onChange: PropTypes.func.isRequired, noDirect: PropTypes.bool, container: PropTypes.func, + disabled: PropTypes.bool, intl: PropTypes.object.isRequired, }; @@ -247,7 +248,7 @@ class PrivacyDropdown extends React.PureComponent { } render () { - const { value, container, intl } = this.props; + const { value, container, disabled, intl } = this.props; const { open, placement } = this.state; const valueOption = this.options.find(item => item.value === value); @@ -267,6 +268,7 @@ class PrivacyDropdown extends React.PureComponent { onMouseDown={this.handleMouseDown} onKeyDown={this.handleButtonKeyDown} style={{ height: null, lineHeight: '27px' }} + disabled={disabled} /> diff --git a/app/javascript/mastodon/features/compose/components/upload.js b/app/javascript/mastodon/features/compose/components/upload.js index b9f0fbe3a..1289d6b94 100644 --- a/app/javascript/mastodon/features/compose/components/upload.js +++ b/app/javascript/mastodon/features/compose/components/upload.js @@ -18,6 +18,7 @@ export default class Upload extends ImmutablePureComponent { media: ImmutablePropTypes.map.isRequired, onUndo: PropTypes.func.isRequired, onOpenFocalPoint: PropTypes.func.isRequired, + isEditingStatus: PropTypes.func.isRequired, }; handleUndoClick = e => { @@ -31,7 +32,7 @@ export default class Upload extends ImmutablePureComponent { } render () { - const { media } = this.props; + const { media, isEditingStatus } = this.props; const focusX = media.getIn(['meta', 'focus', 'x']); const focusY = media.getIn(['meta', 'focus', 'y']); const x = ((focusX / 2) + .5) * 100; @@ -44,7 +45,7 @@ export default class Upload extends ImmutablePureComponent {
- + {!isEditingStatus && ()}
)} diff --git a/app/javascript/mastodon/features/compose/containers/upload_container.js b/app/javascript/mastodon/features/compose/containers/upload_container.js index 05cd2ecc1..1108aec30 100644 --- a/app/javascript/mastodon/features/compose/containers/upload_container.js +++ b/app/javascript/mastodon/features/compose/containers/upload_container.js @@ -5,6 +5,7 @@ import { submitCompose } from '../../../actions/compose'; const mapStateToProps = (state, { id }) => ({ media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id), + isEditingStatus: state.getIn(['compose', 'id']) !== null, }); const mapDispatchToProps = dispatch => ({