diff --git a/app/javascript/flavours/glitch/features/ui/index.jsx b/app/javascript/flavours/glitch/features/ui/index.jsx index 699577bc2b..3cd7db04d6 100644 --- a/app/javascript/flavours/glitch/features/ui/index.jsx +++ b/app/javascript/flavours/glitch/features/ui/index.jsx @@ -94,8 +94,7 @@ const messages = defineMessages({ const mapStateToProps = state => ({ layout: state.getIn(['meta', 'layout']), - hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0, - hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0, + hasComposingContents: state.getIn(['compose', 'text']).trim().length !== 0 || state.getIn(['compose', 'media_attachments']).size > 0 || state.getIn(['compose', 'poll']) !== null, canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4, isWide: state.getIn(['local_settings', 'stretch']), fullWidthColumns: state.getIn(['local_settings', 'fullwidth_columns']), @@ -252,8 +251,7 @@ class UI extends PureComponent { fullWidthColumns: PropTypes.bool, systemFontUi: PropTypes.bool, isComposing: PropTypes.bool, - hasComposingText: PropTypes.bool, - hasMediaAttachments: PropTypes.bool, + hasComposingContents: PropTypes.bool, canUploadMore: PropTypes.bool, intl: PropTypes.object.isRequired, unreadNotifications: PropTypes.number, @@ -272,11 +270,11 @@ class UI extends PureComponent { }; handleBeforeUnload = e => { - const { intl, dispatch, hasComposingText, hasMediaAttachments } = this.props; + const { intl, dispatch, hasComposingContents } = this.props; dispatch(synchronouslySubmitMarkers()); - if (hasComposingText || hasMediaAttachments) { + if (hasComposingContents) { // Setting returnValue to any string causes confirmation dialog. // Many browsers no longer display this text to users, // but we set user-friendly message for other browsers, e.g. Edge.