added obfuscation of NSFW based on setting in app for search page. #1617

Merged
tiger5226 merged 1 commit from markb_1610_nsfw into master 2018-06-18 04:13:56 +02:00
2 changed files with 10 additions and 1 deletions
Showing only changes of commit 7db2471b77 - Show all commits

View file

@ -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 => ({

View file

@ -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<Props> {
navigate,
rewardedContentClaimIds,
showUri,
obscureNsfw,
claimIsMine,
fullWidth,
showLocal,
isDownloaded,
@ -73,6 +77,7 @@ class FileTile extends React.PureComponent<Props> {
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<Props> {
role="button"
tabIndex="0"
>
<CardMedia title={title || name} thumbnail={thumbnail} />
<CardMedia title={title || name} thumbnail={thumbnail} nsfw={shouldObscureNsfw} />
<div className="file-tile__info">
{isResolvingUri && <div className="card__title--small">{__('Loading...')}</div>}
{!isResolvingUri && (