logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

domain_container.js (1260B)


  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 = (state, { }) => ({
  12. });
  13. return mapStateToProps;
  14. };
  15. const mapDispatchToProps = (dispatch, { intl }) => ({
  16. onBlockDomain (domain) {
  17. dispatch(openModal('CONFIRM', {
  18. 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> }} />,
  19. confirm: intl.formatMessage(messages.blockDomainConfirm),
  20. onConfirm: () => dispatch(blockDomain(domain)),
  21. }));
  22. },
  23. onUnblockDomain (domain) {
  24. dispatch(unblockDomain(domain));
  25. },
  26. });
  27. export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Domain));