Merge pull request #1617 from lbryio/markb_1610_nsfw

added obfuscation of NSFW based on setting in app for search page.
This commit is contained in:
Sean Yesmunt 2018-06-17 22:13:55 -04:00 committed by GitHub
commit 82bde114f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

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 && (