From 7db2471b77510f809a1c0382a85d856dde5970ff Mon Sep 17 00:00:00 2001 From: Mark Beamer Jr Date: Sat, 16 Jun 2018 12:49:43 -0400 Subject: [PATCH] added obfuscation of NSFW based on setting in app for search page. --- src/renderer/component/fileTile/index.js | 4 ++++ src/renderer/component/fileTile/view.jsx | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/renderer/component/fileTile/index.js b/src/renderer/component/fileTile/index.js index 3403eef62..17f0bf8a5 100644 --- a/src/renderer/component/fileTile/index.js +++ b/src/renderer/component/fileTile/index.js @@ -5,7 +5,9 @@ import { makeSelectMetadataForUri, makeSelectFileInfoForUri, makeSelectIsUriResolving, + makeSelectClaimIsMine, } from 'lbry-redux'; +import { selectShowNsfw } from 'redux/selectors/settings'; import { doNavigate } from 'redux/actions/navigation'; import { doClearPublish, doUpdatePublishForm } from 'redux/actions/publish'; import { selectRewardContentClaimIds } from 'redux/selectors/content'; @@ -17,6 +19,8 @@ const select = (state, props) => ({ metadata: makeSelectMetadataForUri(props.uri)(state), isResolvingUri: makeSelectIsUriResolving(props.uri)(state), rewardedContentClaimIds: selectRewardContentClaimIds(state, props), + obscureNsfw: !selectShowNsfw(state), + claimIsMine: makeSelectClaimIsMine(props.uri)(state), }); const perform = dispatch => ({ diff --git a/src/renderer/component/fileTile/view.jsx b/src/renderer/component/fileTile/view.jsx index 996d81fde..a508091da 100644 --- a/src/renderer/component/fileTile/view.jsx +++ b/src/renderer/component/fileTile/view.jsx @@ -13,6 +13,8 @@ type Props = { fullWidth: boolean, // removes the max-width css showUri: boolean, showLocal: boolean, + obscureNsfw: boolean, + claimIsMine: boolean, isDownloaded: boolean, uri: string, isResolvingUri: boolean, @@ -58,6 +60,8 @@ class FileTile extends React.PureComponent { navigate, rewardedContentClaimIds, showUri, + obscureNsfw, + claimIsMine, fullWidth, showLocal, isDownloaded, @@ -73,6 +77,7 @@ class FileTile extends React.PureComponent { isClaimed && metadata && metadata.title ? metadata.title : parseURI(uri).contentName; const thumbnail = metadata && metadata.thumbnail ? metadata.thumbnail : null; const isRewardContent = claim && rewardedContentClaimIds.includes(claim.claim_id); + const shouldObscureNsfw = obscureNsfw && metadata && metadata.nsfw && !claimIsMine; const onClick = () => navigate('/show', { uri }); @@ -93,7 +98,7 @@ class FileTile extends React.PureComponent { role="button" tabIndex="0" > - +
{isResolvingUri &&
{__('Loading...')}
} {!isResolvingUri && (