2020-03-25 03:08:43 +00:00
|
|
|
import { injectIntl, defineMessages } from 'react-intl'
|
|
|
|
import { makeGetAccount } from '../../selectors'
|
|
|
|
import { blockAccount } from '../../actions/accounts'
|
|
|
|
import ConfirmationModal from './confirmation_modal'
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
title: { id: 'group_delete_title', defaultMessage: 'Delete "{group}"' },
|
|
|
|
groupMessage: { id: 'confirmations.group_delete.message', defaultMessage: 'Are you sure you want to delete "{group}"?' },
|
|
|
|
delete: { id: 'delete', defaultMessage: 'Delete' },
|
|
|
|
})
|
|
|
|
|
2020-04-11 23:29:19 +01:00
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
onConfirm(account) {
|
|
|
|
// dispatch(blockAccount(account.get('id')))
|
|
|
|
},
|
|
|
|
})
|
2020-03-25 03:08:43 +00:00
|
|
|
|
|
|
|
export default
|
|
|
|
@connect(null, mapDispatchToProps)
|
|
|
|
@injectIntl
|
|
|
|
class GroupDeleteModal extends PureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
group: PropTypes.object.isRequired,
|
|
|
|
onConfirm: PropTypes.func.isRequired,
|
2020-04-07 02:53:23 +01:00
|
|
|
onClose: PropTypes.func.isRequired,
|
2020-03-25 03:08:43 +00:00
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
handleClick = () => {
|
|
|
|
this.props.onConfirm(this.props.account)
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2020-04-07 02:53:23 +01:00
|
|
|
const { group, intl, onClose } = this.props
|
2020-03-25 03:08:43 +00:00
|
|
|
|
|
|
|
const title = intl.formatMessage(messages.title, {
|
|
|
|
group: !!group ? account.get('title') : '',
|
|
|
|
})
|
|
|
|
const message = intl.formatMessage(messages.groupMessage, {
|
|
|
|
group: !!group ? account.get('title') : '',
|
|
|
|
})
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ConfirmationModal
|
|
|
|
title={title}
|
|
|
|
message={message}
|
|
|
|
confirm={intl.formatMessage(messages.delete)}
|
|
|
|
onConfirm={this.handleClick}
|
2020-04-07 02:53:23 +01:00
|
|
|
onClose={onClose}
|
2020-03-25 03:08:43 +00:00
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|