lbry-desktop/ui/modal/modalBlockChannel/index.js
infinite-persistence a05ccdd44f
Comment Moderation - time based bans
## Issue
6712 Comment Moderation - time based bans

## Approach
- Consolidated the 3 types of blocking buttons in the comment content menu (i.e. Block, Moderator Block, Admin Block) into 1 regular Block button.
- Show a modal when Block is clicked.
    - Let user choose the blocklist.
    - Let user choose the timeout duration (this PR's impetus).
2021-09-03 07:17:56 +08:00

25 lines
1.2 KiB
JavaScript

import { connect } from 'react-redux';
import { makeSelectClaimForUri } from 'lbry-redux';
import { doHideModal } from 'redux/actions/app';
import { doCommentModBlock, doCommentModBlockAsAdmin, doCommentModBlockAsModerator } from 'redux/actions/comments';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { selectModerationDelegatorsById } from 'redux/selectors/comments';
import ModalBlockChannel from './view';
const select = (state, props) => ({
activeChannelClaim: selectActiveChannelClaim(state),
contentClaim: makeSelectClaimForUri(props.contentUri)(state),
moderationDelegatorsById: selectModerationDelegatorsById(state),
});
const perform = (dispatch) => ({
closeModal: () => dispatch(doHideModal()),
commentModBlock: (commenterUri, timeoutHours) => dispatch(doCommentModBlock(commenterUri, timeoutHours)),
commentModBlockAsAdmin: (commenterUri, blockerId, timeoutHours) =>
dispatch(doCommentModBlockAsAdmin(commenterUri, blockerId, timeoutHours)),
commentModBlockAsModerator: (commenterUri, creatorId, blockerId, timeoutHours) =>
dispatch(doCommentModBlockAsModerator(commenterUri, creatorId, blockerId, timeoutHours)),
});
export default connect(select, perform)(ModalBlockChannel);