diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-11-11 21:22:17 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-11-12 14:01:47 +0100 |
commit | 9255bfb908f660889f54d4fd5ea92279b09d8cd1 (patch) | |
tree | 86e52f258a09927cb0483a1917d43eb6177ad69e /app/javascript/flavours/glitch/features | |
parent | e2315876f4c7bf591c535f10628fe6e145505a84 (diff) |
[Glitch] Add the ability to edit media attachment metadata for any unattached media
Port 31005aad12c6a915a00501765a6dab25878326cb to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features')
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/upload.js | 7 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/containers/upload_container.js | 1 |
2 files changed, 3 insertions, 5 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/upload.js b/app/javascript/flavours/glitch/features/compose/components/upload.js index c276d339d..6528bbc84 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload.js +++ b/app/javascript/flavours/glitch/features/compose/components/upload.js @@ -18,7 +18,6 @@ export default class Upload extends ImmutablePureComponent { media: ImmutablePropTypes.map.isRequired, onUndo: PropTypes.func.isRequired, onOpenFocalPoint: PropTypes.func.isRequired, - isEditingStatus: PropTypes.bool.isRequired, }; handleUndoClick = e => { @@ -32,7 +31,7 @@ export default class Upload extends ImmutablePureComponent { } render () { - const { intl, media, isEditingStatus } = this.props; + const { media } = this.props; const focusX = media.getIn(['meta', 'focus', 'x']); const focusY = media.getIn(['meta', 'focus', 'y']); const x = ((focusX / 2) + .5) * 100; @@ -45,10 +44,10 @@ export default class Upload extends ImmutablePureComponent { <div className='compose-form__upload-thumbnail' style={{ transform: `scale(${scale})`, backgroundImage: `url(${media.get('preview_url')})`, backgroundPosition: `${x}% ${y}%` }}> <div className='compose-form__upload__actions'> <button className='icon-button' onClick={this.handleUndoClick}><Icon id='times' /> <FormattedMessage id='upload_form.undo' defaultMessage='Delete' /></button> - {!isEditingStatus && (<button className='icon-button' onClick={this.handleFocalPointClick}><Icon id='pencil' /> <FormattedMessage id='upload_form.edit' defaultMessage='Edit' /></button>)} + {!!media.get('unattached') && (<button className='icon-button' onClick={this.handleFocalPointClick}><Icon id='pencil' /> <FormattedMessage id='upload_form.edit' defaultMessage='Edit' /></button>)} </div> - {(media.get('description') || '').length === 0 && !isEditingStatus && ( + {(media.get('description') || '').length === 0 && !!media.get('unattached') && ( <div className='compose-form__upload__warning'> <button className='icon-button' onClick={this.handleFocalPointClick}><Icon id='info-circle' /> <FormattedMessage id='upload_form.description_missing' defaultMessage='No description added' /></button> </div> diff --git a/app/javascript/flavours/glitch/features/compose/containers/upload_container.js b/app/javascript/flavours/glitch/features/compose/containers/upload_container.js index d6256fe96..f3ca4ce7b 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/upload_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/upload_container.js @@ -5,7 +5,6 @@ import { submitCompose } from 'flavours/glitch/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 => ({ |