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));
// 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(
outpoint =>
(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
// or signing channel outpoint is in the filter list
if (claim && !shouldHide && filteredOutpoints) {
if (claim && !claimIsMine && !shouldHide && filteredOutpoints) {
shouldHide = filteredOutpoints.some(
outpoint =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||

View file

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

View file

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