diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-02-11 00:53:12 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2021-02-12 12:31:49 +0100 |
commit | 49eef466b8274ca5768deca3309af31bfbf81184 (patch) | |
tree | 2689e394f9f88d05533e70ad0f6bcf622ee2fd5c /app/javascript/flavours/glitch/features/compose | |
parent | 9213b026565ff7da4c363b015c3aa46921ecdcc6 (diff) |
[Glitch] Add dropdown for boost privacy in boost confirmation modal
Port 07b46cb332ae197584e3ed3f23fe814b7793ec4c to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose')
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/dropdown.js | 8 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.js | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown.js b/app/javascript/flavours/glitch/features/compose/components/dropdown.js index 04ef3964b..abf7cbba1 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown.js +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown.js @@ -31,6 +31,8 @@ export default class ComposerOptionsDropdown extends React.PureComponent { title: PropTypes.string, value: PropTypes.string, onChange: PropTypes.func, + noModal: PropTypes.bool, + container: PropTypes.func, }; state = { @@ -42,10 +44,10 @@ export default class ComposerOptionsDropdown extends React.PureComponent { // Toggles opening and closing the dropdown. handleToggle = ({ target, type }) => { - const { onModalOpen } = this.props; + const { onModalOpen, noModal } = this.props; const { open } = this.state; - if (isUserTouching()) { + if (!noModal && isUserTouching()) { if (this.state.open) { this.props.onModalClose(); } else { @@ -183,6 +185,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent { items, onChange, value, + container, } = this.props; const { open, placement } = this.state; const computedClass = classNames('composer--options--dropdown', { @@ -219,6 +222,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent { placement={placement} show={open} target={this} + container={container} > <DropdownMenu items={items} diff --git a/app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.js b/app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.js index ec8d1378e..39f7c7bd1 100644 --- a/app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.js +++ b/app/javascript/flavours/glitch/features/compose/components/privacy_dropdown.js @@ -53,12 +53,13 @@ class PrivacyDropdown extends React.PureComponent { value: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, noDirect: PropTypes.bool, + noModal: PropTypes.bool, container: PropTypes.func, intl: PropTypes.object.isRequired, }; render () { - const { value, onChange, onModalOpen, onModalClose, disabled, intl } = this.props; + const { value, onChange, onModalOpen, onModalClose, disabled, noDirect, noModal, container, intl } = this.props; // We predefine our privacy items so that we can easily pick the // dropdown icon later. @@ -89,7 +90,11 @@ class PrivacyDropdown extends React.PureComponent { }, }; - const items = [privacyItems.public, privacyItems.unlisted, privacyItems.private, privacyItems.direct]; + const items = [privacyItems.public, privacyItems.unlisted, privacyItems.private]; + + if (!noDirect) { + items.push(privacyItems.direct); + } return ( <Dropdown @@ -100,6 +105,8 @@ class PrivacyDropdown extends React.PureComponent { onModalClose={onModalClose} onModalOpen={onModalOpen} title={intl.formatMessage(messages.change_privacy)} + container={container} + noModal={noModal} value={value} /> ); |