From 85366feef9a625543e185a772d8c5c815bc8adeb Mon Sep 17 00:00:00 2001 From: Kenny Korte Date: Tue, 12 Jun 2018 23:21:31 +0200 Subject: [PATCH] #1581 - Show smaller NSFW tag if it's my content --- src/renderer/component/fileCard/index.js | 7 ++++++- src/renderer/component/fileCard/view.jsx | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/renderer/component/fileCard/index.js b/src/renderer/component/fileCard/index.js index dcb4774f9..3754e3ffa 100644 --- a/src/renderer/component/fileCard/index.js +++ b/src/renderer/component/fileCard/index.js @@ -5,6 +5,7 @@ import { makeSelectMetadataForUri, makeSelectFileInfoForUri, makeSelectIsUriResolving, + makeSelectClaimIsMine, } from 'lbry-redux'; import { doNavigate } from 'redux/actions/navigation'; import { selectRewardContentClaimIds } from 'redux/selectors/content'; @@ -27,6 +28,7 @@ const select = (state, props) => { return { obscureNsfw: !selectShowNsfw(state), + claimIsMine: makeSelectClaimIsMine(props.uri)(state), rewardedContentClaimIds: selectRewardContentClaimIds(state, props), ...fileCardInfo, pending: !!pendingPublish, @@ -38,4 +40,7 @@ const perform = dispatch => ({ resolveUri: uri => dispatch(doResolveUri(uri)), }); -export default connect(select, perform)(FileCard); +export default connect( + select, + perform +)(FileCard); diff --git a/src/renderer/component/fileCard/view.jsx b/src/renderer/component/fileCard/view.jsx index 6189ac7bd..4cc30bf15 100644 --- a/src/renderer/component/fileCard/view.jsx +++ b/src/renderer/component/fileCard/view.jsx @@ -16,12 +16,17 @@ type Props = { uri: string, claim: ?{ claim_id: string }, fileInfo: ?{}, - metadata: ?{ nsfw: boolean, thumbnail: ?string }, + metadata: ?{ nsfw: boolean, title: string, thumbnail: ?string }, navigate: (string, ?{}) => void, rewardedContentClaimIds: Array, obscureNsfw: boolean, + claimIsMine: boolean, showPrice: boolean, pending?: boolean, + /* eslint-disable react/no-unused-prop-types */ + resolveUri: string => void, + isResolvingUri: boolean, + /* eslint-enable react/no-unused-prop-types */ }; class FileCard extends React.PureComponent { @@ -53,13 +58,14 @@ class FileCard extends React.PureComponent { navigate, rewardedContentClaimIds, obscureNsfw, + claimIsMine, showPrice, pending, } = this.props; const uri = !pending ? normalizeURI(this.props.uri) : this.props.uri; const title = metadata && metadata.title ? metadata.title : uri; const thumbnail = metadata && metadata.thumbnail ? metadata.thumbnail : null; - const shouldObscureNsfw = obscureNsfw && metadata && metadata.nsfw; + const shouldObscureNsfw = obscureNsfw && metadata && metadata.nsfw && !claimIsMine; const isRewardContent = claim && rewardedContentClaimIds.includes(claim.claim_id); const handleContextMenu = event => { event.preventDefault();