You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.2 KiB

  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import { blockDomain, unblockDomain } from '../actions/domain_blocks';
  4. import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
  5. import Domain from '../components/domain';
  6. import { openModal } from '../actions/modal';
  7. const messages = defineMessages({
  8. blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' },
  9. });
  10. const makeMapStateToProps = () => {
  11. const mapStateToProps = () => ({});
  12. return mapStateToProps;
  13. };
  14. const mapDispatchToProps = (dispatch, { intl }) => ({
  15. onBlockDomain (domain) {
  16. dispatch(openModal('CONFIRM', {
  17. message: <FormattedMessage id='confirmations.domain_block.message' defaultMessage='Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.' values={{ domain: <strong>{domain}</strong> }} />,
  18. confirm: intl.formatMessage(messages.blockDomainConfirm),
  19. onConfirm: () => dispatch(blockDomain(domain)),
  20. }));
  21. },
  22. onUnblockDomain (domain) {
  23. dispatch(unblockDomain(domain));
  24. },
  25. });
  26. export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Domain));