[Glitch] Add a “Block & Report” button to the block confirmation dialog
Port 6df4a82969
to glitch-soc
This commit is contained in:
@ -11,6 +11,8 @@ export default class ConfirmationModal extends React.PureComponent {
|
||||
confirm: PropTypes.string.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
onConfirm: PropTypes.func.isRequired,
|
||||
secondary: PropTypes.string,
|
||||
onSecondary: PropTypes.func,
|
||||
onDoNotAsk: PropTypes.func,
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
@ -27,6 +29,11 @@ export default class ConfirmationModal extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
handleSecondary = () => {
|
||||
this.props.onClose();
|
||||
this.props.onSecondary();
|
||||
}
|
||||
|
||||
handleCancel = () => {
|
||||
this.props.onClose();
|
||||
}
|
||||
@ -40,7 +47,7 @@ export default class ConfirmationModal extends React.PureComponent {
|
||||
}
|
||||
|
||||
render () {
|
||||
const { message, confirm, onDoNotAsk } = this.props;
|
||||
const { message, confirm, secondary, onDoNotAsk } = this.props;
|
||||
|
||||
return (
|
||||
<div className='modal-root__modal confirmation-modal'>
|
||||
@ -61,6 +68,9 @@ export default class ConfirmationModal extends React.PureComponent {
|
||||
<Button onClick={this.handleCancel} className='confirmation-modal__cancel-button'>
|
||||
<FormattedMessage id='confirmation_modal.cancel' defaultMessage='Cancel' />
|
||||
</Button>
|
||||
{secondary !== undefined && (
|
||||
<Button text={secondary} onClick={this.handleSecondary} className='confirmation-modal__secondary-button' />
|
||||
)}
|
||||
<Button text={confirm} onClick={this.handleClick} ref={this.setRef} />
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user