lbry-desktop/ui/component/reportContent/index.js
infinite-persistence 68a4697c7d
ReportContent: add ?commentId support (#1826)
## Ticket
1822

## Changes
- Add `?commentId=` support in the URL.
- `claimId` remains a required parameter so that we can derive the comment URL.
    - The backend will know it's a comment report when both parameters are present.
- The comment URL is added to the top of `additional_details`.
- The backend rejects if `additional_details` is provided for DMCA. Grayed out DMCA for the case of reporting comments.
2022-07-12 13:44:34 -04:00

36 lines
1.3 KiB
JavaScript

import { connect } from 'react-redux';
import { doCommentById } from 'redux/actions/comments';
import { doReportContent } from 'redux/actions/reportContent';
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
import { selectCommentForCommentId } from 'redux/selectors/comments';
import { selectIsReportingContent, selectReportContentError } from 'redux/selectors/reportContent';
import { doClaimSearch } from 'redux/actions/claims';
import { selectClaimForClaimId } from 'redux/selectors/claims';
import { withRouter } from 'react-router';
import ReportContent from './view';
const select = (state, props) => {
const { search } = props.location;
const urlParams = new URLSearchParams(search);
const claimId = urlParams.get('claimId');
const commentId = urlParams.get('commentId');
return {
claimId,
commentId,
isReporting: selectIsReportingContent(state),
error: selectReportContentError(state),
activeChannelClaim: selectActiveChannelClaim(state),
incognito: selectIncognito(state),
claim: selectClaimForClaimId(state, claimId),
comment: selectCommentForCommentId(state, commentId),
};
};
const perform = {
doClaimSearch,
doCommentById,
doReportContent,
};
export default withRouter(connect(select, perform)(ReportContent));