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).
|
||||
|
||||
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 { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
|
||||
|
@ -18,7 +18,8 @@ export const selectBanStateForUri = createCachedSelector(
|
|||
selectFilteredOutpointMap,
|
||||
selectMutedChannels,
|
||||
selectModerationBlockList,
|
||||
(claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist) => {
|
||||
(state, uri) => makeSelectIsBlacklisted(uri)(state),
|
||||
(claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist, isBlacklisted) => {
|
||||
const banState = {};
|
||||
|
||||
if (!claim) {
|
||||
|
@ -27,6 +28,10 @@ export const selectBanStateForUri = createCachedSelector(
|
|||
|
||||
const channelClaim = getChannelFromClaim(claim);
|
||||
|
||||
if (isBlacklisted) {
|
||||
banState['blacklisted'] = true;
|
||||
}
|
||||
|
||||
// This will be replaced once blocking is done at the wallet server level.
|
||||
if (blackListedOutpointMap) {
|
||||
if (
|
||||
|
|
|
@ -11,6 +11,8 @@ import {
|
|||
selectClaimIsMine,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectIsBlacklisted,
|
||||
makeSelectBlacklistedDueToDMCA,
|
||||
makeSelectClaimErrorCensor,
|
||||
} from 'redux/selectors/claims';
|
||||
import {
|
||||
makeSelectCollectionForId,
|
||||
|
@ -82,6 +84,8 @@ const select = (state, props) => {
|
|||
collectionUrls: makeSelectUrlsForCollectionId(collectionId)(state),
|
||||
isResolvingCollection: makeSelectIsResolvingCollectionForId(collectionId)(state),
|
||||
isBlacklisted: makeSelectIsBlacklisted(uri)(state),
|
||||
isBlacklistedDueToDMCA: makeSelectBlacklistedDueToDMCA(uri)(state),
|
||||
errorCensor: makeSelectClaimErrorCensor(uri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ type Props = {
|
|||
isResolvingCollection: boolean,
|
||||
fetchCollectionItems: (string) => void,
|
||||
isBlacklisted: boolean,
|
||||
isBlacklistedDueToDMCA: boolean,
|
||||
errorCensor: ?ClaimErrorCensor,
|
||||
};
|
||||
|
||||
function ShowPage(props: Props) {
|
||||
|
@ -51,6 +53,8 @@ function ShowPage(props: Props) {
|
|||
collectionUrls,
|
||||
isResolvingCollection,
|
||||
isBlacklisted,
|
||||
isBlacklistedDueToDMCA,
|
||||
errorCensor,
|
||||
} = props;
|
||||
|
||||
const { search } = location;
|
||||
|
@ -141,12 +145,12 @@ function ShowPage(props: Props) {
|
|||
} else if (claim && claim.name.length && claim.name[0] === '@') {
|
||||
innerContent = <ChannelPage uri={uri} location={location} />;
|
||||
} else if (isBlacklisted && !claimIsMine) {
|
||||
innerContent = (
|
||||
innerContent = isBlacklistedDueToDMCA ? (
|
||||
<Page>
|
||||
<Card
|
||||
title={uri}
|
||||
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={
|
||||
<div className="section__actions">
|
||||
|
@ -155,6 +159,22 @@ function ShowPage(props: Props) {
|
|||
}
|
||||
/>
|
||||
</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) {
|
||||
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 makeSelectBlacklistedDueToDMCA = (claimUri: string) =>
|
||||
createSelector(makeSelectClaimErrorCensor(claimUri), (claimError) => {
|
||||
if (!claimError) {
|
||||
return false;
|
||||
}
|
||||
return claimError.name === '@LBRY-DMCA';
|
||||
});
|
||||
|
||||
export const makeSelectClaimErrorCensor = (claimUri: string) =>
|
||||
createSelector(selectState, (state) => state.blacklistedByUri[claimUri]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue