Properly handle blacklisted claims. #7665
4 changed files with 41 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
||||||
// involve moving it from 'extras' to 'ui' (big change).
|
// involve moving it from 'extras' to 'ui' (big change).
|
||||||
|
|
||||||
import { createCachedSelector } from 're-reselect';
|
import { createCachedSelector } from 're-reselect';
|
||||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
import { selectClaimForUri, makeSelectIsBlacklisted } from 'redux/selectors/claims';
|
||||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||||
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
|
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
|
||||||
|
@ -18,7 +18,8 @@ export const selectBanStateForUri = createCachedSelector(
|
||||||
selectFilteredOutpointMap,
|
selectFilteredOutpointMap,
|
||||||
selectMutedChannels,
|
selectMutedChannels,
|
||||||
selectModerationBlockList,
|
selectModerationBlockList,
|
||||||
(claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist) => {
|
(state, uri) => makeSelectIsBlacklisted(uri)(state),
|
||||||
|
(claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist, isBlacklisted) => {
|
||||||
const banState = {};
|
const banState = {};
|
||||||
|
|
||||||
if (!claim) {
|
if (!claim) {
|
||||||
|
@ -27,6 +28,10 @@ export const selectBanStateForUri = createCachedSelector(
|
||||||
|
|
||||||
const channelClaim = getChannelFromClaim(claim);
|
const channelClaim = getChannelFromClaim(claim);
|
||||||
|
|
||||||
|
if (isBlacklisted) {
|
||||||
|
banState['blacklisted'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
// This will be replaced once blocking is done at the wallet server level.
|
// This will be replaced once blocking is done at the wallet server level.
|
||||||
if (blackListedOutpointMap) {
|
if (blackListedOutpointMap) {
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -11,6 +11,8 @@ import {
|
||||||
selectClaimIsMine,
|
selectClaimIsMine,
|
||||||
makeSelectClaimIsPending,
|
makeSelectClaimIsPending,
|
||||||
makeSelectIsBlacklisted,
|
makeSelectIsBlacklisted,
|
||||||
|
makeSelectBlacklistedDueToDMCA,
|
||||||
|
makeSelectClaimErrorCensor,
|
||||||
} from 'redux/selectors/claims';
|
} from 'redux/selectors/claims';
|
||||||
import {
|
import {
|
||||||
makeSelectCollectionForId,
|
makeSelectCollectionForId,
|
||||||
|
@ -82,6 +84,8 @@ const select = (state, props) => {
|
||||||
collectionUrls: makeSelectUrlsForCollectionId(collectionId)(state),
|
collectionUrls: makeSelectUrlsForCollectionId(collectionId)(state),
|
||||||
isResolvingCollection: makeSelectIsResolvingCollectionForId(collectionId)(state),
|
isResolvingCollection: makeSelectIsResolvingCollectionForId(collectionId)(state),
|
||||||
isBlacklisted: makeSelectIsBlacklisted(uri)(state),
|
isBlacklisted: makeSelectIsBlacklisted(uri)(state),
|
||||||
|
isBlacklistedDueToDMCA: makeSelectBlacklistedDueToDMCA(uri)(state),
|
||||||
|
errorCensor: makeSelectClaimErrorCensor(uri)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ type Props = {
|
||||||
isResolvingCollection: boolean,
|
isResolvingCollection: boolean,
|
||||||
fetchCollectionItems: (string) => void,
|
fetchCollectionItems: (string) => void,
|
||||||
isBlacklisted: boolean,
|
isBlacklisted: boolean,
|
||||||
|
isBlacklistedDueToDMCA: boolean,
|
||||||
|
errorCensor: ?ClaimErrorCensor,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ShowPage(props: Props) {
|
function ShowPage(props: Props) {
|
||||||
|
@ -51,6 +53,8 @@ function ShowPage(props: Props) {
|
||||||
collectionUrls,
|
collectionUrls,
|
||||||
isResolvingCollection,
|
isResolvingCollection,
|
||||||
isBlacklisted,
|
isBlacklisted,
|
||||||
|
isBlacklistedDueToDMCA,
|
||||||
|
errorCensor,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { search } = location;
|
const { search } = location;
|
||||||
|
@ -141,12 +145,12 @@ function ShowPage(props: Props) {
|
||||||
} else if (claim && claim.name.length && claim.name[0] === '@') {
|
} else if (claim && claim.name.length && claim.name[0] === '@') {
|
||||||
innerContent = <ChannelPage uri={uri} location={location} />;
|
innerContent = <ChannelPage uri={uri} location={location} />;
|
||||||
} else if (isBlacklisted && !claimIsMine) {
|
} else if (isBlacklisted && !claimIsMine) {
|
||||||
innerContent = (
|
innerContent = isBlacklistedDueToDMCA ? (
|
||||||
<Page>
|
<Page>
|
||||||
<Card
|
<Card
|
||||||
title={uri}
|
title={uri}
|
||||||
subtitle={__(
|
subtitle={__(
|
||||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.'
|
'In response to a complaint we received under the US Digital Millennium Copyright Act, hub have blocked access to this content from our applications.'
|
||||||
)}
|
)}
|
||||||
actions={
|
actions={
|
||||||
<div className="section__actions">
|
<div className="section__actions">
|
||||||
|
@ -155,6 +159,22 @@ function ShowPage(props: Props) {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Page>
|
</Page>
|
||||||
|
) : (
|
||||||
|
<Page>
|
||||||
|
<Card
|
||||||
|
title={uri}
|
||||||
|
subtitle={
|
||||||
|
<>
|
||||||
|
{__('Your hub has blocked this content because it has subscribed to the following channel:')}{' '}
|
||||||
|
<Button
|
||||||
|
button="link"
|
||||||
|
href={errorCensor && errorCensor.canonical_url}
|
||||||
|
label={errorCensor && errorCensor.name}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Page>
|
||||||
);
|
);
|
||||||
} else if (claim) {
|
} else if (claim) {
|
||||||
innerContent = <FilePage uri={uri} location={location} />;
|
innerContent = <FilePage uri={uri} location={location} />;
|
||||||
|
|
|
@ -84,6 +84,14 @@ export const selectClaimIdForUri = (state: State, uri: string) => selectClaimIds
|
||||||
|
|
||||||
export const selectReflectingById = (state: State) => selectState(state).reflectingById;
|
export const selectReflectingById = (state: State) => selectState(state).reflectingById;
|
||||||
|
|
||||||
|
export const makeSelectBlacklistedDueToDMCA = (claimUri: string) =>
|
||||||
|
createSelector(makeSelectClaimErrorCensor(claimUri), (claimError) => {
|
||||||
|
if (!claimError) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return claimError.name === '@LBRY-DMCA';
|
||||||
|
});
|
||||||
|
|
||||||
export const makeSelectClaimErrorCensor = (claimUri: string) =>
|
export const makeSelectClaimErrorCensor = (claimUri: string) =>
|
||||||
createSelector(selectState, (state) => state.blacklistedByUri[claimUri]);
|
createSelector(selectState, (state) => state.blacklistedByUri[claimUri]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue