From 5156c90a606455c5fb5341e0ac50e64868df0362 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Fri, 13 Dec 2019 13:44:28 -0500 Subject: [PATCH] fix: blocked content handling of own content Fixes: https://github.com/lbryio/lbry-desktop/issues/1719 / https://github.com/lbryio/lbry-desktop/issues/1719 --- ui/component/claimPreview/view.jsx | 4 +-- ui/page/show/index.js | 4 +++ ui/page/show/view.jsx | 55 ++++++++++++++++++++---------- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/ui/component/claimPreview/view.jsx b/ui/component/claimPreview/view.jsx index fc8b25708..cbc921fe2 100644 --- a/ui/component/claimPreview/view.jsx +++ b/ui/component/claimPreview/view.jsx @@ -109,7 +109,7 @@ const ClaimPreview = forwardRef((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((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) || diff --git a/ui/page/show/index.js b/ui/page/show/index.js index 53e62e0f8..6a12b0bb2 100644 --- a/ui/page/show/index.js +++ b/ui/page/show/index.js @@ -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), }; }; diff --git a/ui/page/show/view.jsx b/ui/page/show/view.jsx index 589cdbeff..98542d1f4 100644 --- a/ui/page/show/view.jsx +++ b/ui/page/show/view.jsx @@ -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 = ( - -
-
{uri}
-

- {__( - 'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.' - )} -

-
-
-
-
- ); + let blockedMessage = ( +
+
{uri}
+

+ {__( + 'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.' + )} +

+
+
+
+ ); + + if (isClaimBlackListed && !claimIsMine) { + innerContent = {blockedMessage}; } else { - innerContent = ; + innerContent = + isClaimBlackListed || fileInfo ? ( +
+ {blockedMessage} +
+ ) : ( + + ); } }