fix: blocked content handling of own content

Fixes:  https://github.com/lbryio/lbry-desktop/issues/1719 / https://github.com/lbryio/lbry-desktop/issues/1719
This commit is contained in:
Thomas Zarebczan 2019-12-13 13:44:28 -05:00 committed by Sean Yesmunt
parent 98ee17411b
commit 5156c90a60
3 changed files with 43 additions and 20 deletions

View file

@ -109,7 +109,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
((abandoned && !showPublishLink) || (!claimIsMine && obscureNsfw && nsfw)); ((abandoned && !showPublishLink) || (!claimIsMine && obscureNsfw && nsfw));
// 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 (claim && !shouldHide && blackListedOutpoints) { if (claim && !claimIsMine && !shouldHide && blackListedOutpoints) {
shouldHide = blackListedOutpoints.some( shouldHide = blackListedOutpoints.some(
outpoint => outpoint =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) || (signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
@ -118,7 +118,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
} }
// We're checking to see if the stream outpoint // We're checking to see if the stream outpoint
// or signing channel outpoint is in the filter list // or signing channel outpoint is in the filter list
if (claim && !shouldHide && filteredOutpoints) { if (claim && !claimIsMine && !shouldHide && filteredOutpoints) {
shouldHide = filteredOutpoints.some( shouldHide = filteredOutpoints.some(
outpoint => outpoint =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) || (signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||

View file

@ -7,6 +7,8 @@ import {
makeSelectTotalPagesForChannel, makeSelectTotalPagesForChannel,
makeSelectTitleForUri, makeSelectTitleForUri,
normalizeURI, normalizeURI,
makeSelectClaimIsMine,
makeSelectFileInfoForUri,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectBlackListedOutpoints } from 'lbryinc'; import { selectBlackListedOutpoints } from 'lbryinc';
import ShowPage from './view'; import ShowPage from './view';
@ -38,6 +40,8 @@ const select = (state, props) => {
totalPages: makeSelectTotalPagesForChannel(uri, PAGE_SIZE)(state), totalPages: makeSelectTotalPagesForChannel(uri, PAGE_SIZE)(state),
uri, uri,
title: makeSelectTitleForUri(uri)(state), title: makeSelectTitleForUri(uri)(state),
claimIsMine: makeSelectClaimIsMine(uri)(state),
fileInfo: makeSelectFileInfoForUri(uri)(state),
}; };
}; };

View file

@ -19,10 +19,22 @@ type Props = {
nout: number, nout: number,
}>, }>,
title: string, title: string,
claimIsMine: Boolean,
fileInfo: FileListItem,
}; };
function ShowPage(props: Props) { function ShowPage(props: Props) {
const { isResolvingUri, resolveUri, uri, claim, blackListedOutpoints, location, title } = props; const {
isResolvingUri,
resolveUri,
uri,
claim,
blackListedOutpoints,
location,
title,
claimIsMine,
fileInfo,
} = props;
const { channelName, streamName } = parseURI(uri); const { channelName, streamName } = parseURI(uri);
const signingChannel = claim && claim.signing_channel; const signingChannel = claim && claim.signing_channel;
const canonicalUrl = claim && claim.canonical_url; const canonicalUrl = claim && claim.canonical_url;
@ -86,24 +98,31 @@ function ShowPage(props: Props) {
(outpoint.txid === claim.txid && outpoint.nout === claim.nout) (outpoint.txid === claim.txid && outpoint.nout === claim.nout)
); );
if (isClaimBlackListed) { let blockedMessage = (
innerContent = ( <section className="card card--section">
<Page> <div className="card__title card__title--deprecated">{uri}</div>
<section className="card card--section"> <p>
<div className="card__title card__title--deprecated">{uri}</div> {__(
<p> '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, we have blocked access to this content from our applications.' </p>
)} <div className="card__actions">
</p> <Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} />
<div className="card__actions"> </div>
<Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} /> </section>
</div> );
</section>
</Page> if (isClaimBlackListed && !claimIsMine) {
); innerContent = <Page>{blockedMessage}</Page>;
} else { } else {
innerContent = <FilePage uri={uri} location={location} />; innerContent =
isClaimBlackListed || fileInfo ? (
<div>
{blockedMessage} <FilePage uri={uri} location={location} />
</div>
) : (
<FilePage uri={uri} location={location} />
);
} }
} }