diff options
Diffstat (limited to 'app/javascript/mastodon/features/compose/components/privacy_dropdown.js')
-rw-r--r-- | app/javascript/mastodon/features/compose/components/privacy_dropdown.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js index 309f46290..df59f46b3 100644 --- a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js +++ b/app/javascript/mastodon/features/compose/components/privacy_dropdown.js @@ -127,7 +127,7 @@ class PrivacyDropdownMenu extends React.PureComponent { // It should not be transformed when mounting because the resulting // size will be used to determine the coordinate of the menu by // react-overlays - <div className={`privacy-dropdown__dropdown ${placement}`} style={{ ...style, opacity: opacity, transform: mounted ? `scale(${scaleX}, ${scaleY})` : null, zIndex: 2 }} role='listbox' ref={this.setRef}> + <div className={`privacy-dropdown__dropdown ${placement}`} style={{ ...style, opacity: opacity, transform: mounted ? `scale(${scaleX}, ${scaleY})` : null }} role='listbox' ref={this.setRef}> {items.map(item => ( <div role='option' tabIndex='0' key={item.value} data-index={item.value} onKeyDown={this.handleKeyDown} onClick={this.handleClick} className={classNames('privacy-dropdown__option', { active: item.value === value })} aria-selected={item.value === value} ref={item.value === value ? this.setFocusRef : null}> <div className='privacy-dropdown__option__icon'> @@ -153,11 +153,12 @@ class PrivacyDropdown extends React.PureComponent { static propTypes = { isUserTouching: PropTypes.func, - isModalOpen: PropTypes.bool.isRequired, onModalOpen: PropTypes.func, onModalClose: PropTypes.func, value: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, + noDirect: PropTypes.bool, + container: PropTypes.func, intl: PropTypes.object.isRequired, }; @@ -167,7 +168,7 @@ class PrivacyDropdown extends React.PureComponent { }; handleToggle = ({ target }) => { - if (this.props.isUserTouching()) { + if (this.props.isUserTouching && this.props.isUserTouching()) { if (this.state.open) { this.props.onModalClose(); } else { @@ -236,12 +237,17 @@ class PrivacyDropdown extends React.PureComponent { { icon: 'globe', value: 'public', text: formatMessage(messages.public_short), meta: formatMessage(messages.public_long) }, { icon: 'unlock', value: 'unlisted', text: formatMessage(messages.unlisted_short), meta: formatMessage(messages.unlisted_long) }, { icon: 'lock', value: 'private', text: formatMessage(messages.private_short), meta: formatMessage(messages.private_long) }, - { icon: 'envelope', value: 'direct', text: formatMessage(messages.direct_short), meta: formatMessage(messages.direct_long) }, ]; + + if (!this.props.noDirect) { + this.options.push( + { icon: 'envelope', value: 'direct', text: formatMessage(messages.direct_short), meta: formatMessage(messages.direct_long) }, + ); + } } render () { - const { value, intl } = this.props; + const { value, container, intl } = this.props; const { open, placement } = this.state; const valueOption = this.options.find(item => item.value === value); @@ -264,7 +270,7 @@ class PrivacyDropdown extends React.PureComponent { /> </div> - <Overlay show={open} placement={placement} target={this}> + <Overlay show={open} placement={placement} target={this} container={container}> <PrivacyDropdownMenu items={this.options} value={value} |