2020-03-24 04:39:12 +00:00
|
|
|
import { injectIntl, defineMessages } from 'react-intl'
|
|
|
|
import { muteAccount } from '../../actions/accounts'
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
muteMessage: { id: 'confirmations.mute.message', defaultMessage: 'Are you sure you want to mute {name}?' },
|
|
|
|
cancel: { id: 'confirmation_modal.cancel', defaultMessage: 'Cancel' },
|
|
|
|
confirm: { id: 'confirmations.mute.confirm', defaultMessage: 'Mute' },
|
|
|
|
})
|
|
|
|
|
2020-04-11 23:29:19 +01:00
|
|
|
const mapStateToProps = (state) => ({
|
|
|
|
isSubmitting: state.getIn(['reports', 'new', 'isSubmitting']),
|
|
|
|
account: state.getIn(['mutes', 'new', 'account']),
|
|
|
|
})
|
2020-03-24 04:39:12 +00:00
|
|
|
|
2020-04-11 23:29:19 +01:00
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
onConfirm(account, notifications) {
|
|
|
|
dispatch(muteAccount(account.get('id'), notifications))
|
|
|
|
},
|
|
|
|
})
|
2020-03-24 04:39:12 +00:00
|
|
|
|
|
|
|
export default
|
|
|
|
@connect(mapStateToProps, mapDispatchToProps)
|
|
|
|
@injectIntl
|
|
|
|
class UnfollowModal extends PureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
isSubmitting: PropTypes.bool.isRequired,
|
|
|
|
account: PropTypes.object.isRequired,
|
|
|
|
onConfirm: PropTypes.func.isRequired,
|
2020-04-07 02:53:23 +01:00
|
|
|
onClose: PropTypes.func.isRequired,
|
2020-03-24 04:39:12 +00:00
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this.button.focus()
|
|
|
|
}
|
|
|
|
|
|
|
|
handleClick = () => {
|
|
|
|
this.props.onClose()
|
|
|
|
this.props.onConfirm(this.props.account, this.props.notifications)
|
|
|
|
}
|
|
|
|
|
|
|
|
handleCancel = () => {
|
|
|
|
this.props.onClose()
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { account, intl } = this.props
|
|
|
|
|
|
|
|
// , {
|
|
|
|
// message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
|
|
|
// confirm: intl.formatMessage(messages.unfollowConfirm),
|
|
|
|
// onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
|
|
|
|
// }));
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ConfirmationModal
|
|
|
|
title={`Mute @${account.get('acct')}`}
|
|
|
|
message={<FormattedMessage id='confirmations.mute.message' defaultMessage='Are you sure you want to mute @{name}?' values={{ name: account.get('acct') }} />}
|
|
|
|
confirm={<FormattedMessage id='mute' defaultMessage='Mute' />}
|
2020-04-07 02:53:23 +01:00
|
|
|
onClose={onClose}
|
2020-03-24 04:39:12 +00:00
|
|
|
onConfirm={() => {
|
|
|
|
// dispatch(blockDomain(domain))
|
|
|
|
// dispatch(blockDomain(domain))
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|