diff --git a/src/ui/component/claimPreview/index.js b/src/ui/component/claimPreview/index.js index c9dfd3965..554c63694 100644 --- a/src/ui/component/claimPreview/index.js +++ b/src/ui/component/claimPreview/index.js @@ -15,7 +15,7 @@ import { doPrepareEdit, } from 'lbry-redux'; import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc'; -import { selectShowMatureContent } from 'redux/selectors/settings'; +import { selectShowMatureContent, selectShowAnonymousContent } from 'redux/selectors/settings'; import { makeSelectHasVisitedUri } from 'redux/selectors/content'; import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions'; import { push } from 'connected-react-router'; @@ -26,6 +26,7 @@ const select = (state, props) => ({ pending: props.uri && makeSelectClaimIsPending(props.uri)(state), claim: props.uri && makeSelectClaimForUri(props.uri)(state), obscureNsfw: !selectShowMatureContent(state), + hideAnonymous: !selectShowAnonymousContent(state), claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state), isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state), thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state), diff --git a/src/ui/component/claimPreview/view.jsx b/src/ui/component/claimPreview/view.jsx index dcc5835a4..34a57961f 100644 --- a/src/ui/component/claimPreview/view.jsx +++ b/src/ui/component/claimPreview/view.jsx @@ -22,6 +22,7 @@ type Props = { uri: string, claim: ?Claim, obscureNsfw: boolean, + hideAnonymous: boolean, showUserBlocked: boolean, claimIsMine: boolean, pending?: boolean, @@ -54,6 +55,7 @@ type Props = { const ClaimPreview = forwardRef((props: Props, ref: any) => { const { obscureNsfw, + hideAnonymous, claimIsMine, pending, history, @@ -99,8 +101,9 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { const isChannel = isValid ? parseURI(uri).isChannel : false; const includeChannelTooltip = type !== 'inline' && type !== 'tooltip' && !isChannel; const signingChannel = claim && claim.signing_channel; - let shouldHide = - placeholder !== 'loading' && ((abandoned && !showPublishLink) || (!claimIsMine && obscureNsfw && nsfw)); + const isAnonymous = !isChannel && !signingChannel; + const blocked = !claimIsMine && ((obscureNsfw && nsfw) || (hideAnonymous && isAnonymous)); + let shouldHide = placeholder !== 'loading' && ((abandoned && !showPublishLink) || (blocked && !showUserBlocked)); // This will be replaced once blocking is done at the wallet server level if (claim && !shouldHide && blackListedOutpoints) { @@ -125,7 +128,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { } // block channel claims if we can't control for them in claim search // e.g. fetchRecommendedSubscriptions - if (claim && isChannel && !shouldHide && !showUserBlocked && blockedChannelUris.length && isChannel) { + if (claim && isChannel && !shouldHide && !showUserBlocked && blockedChannelUris.length) { shouldHide = blockedChannelUris.some(blockedUri => blockedUri === claim.permanent_url); } diff --git a/src/ui/constants/settings.js b/src/ui/constants/settings.js index bdfba8655..c9c7ddaeb 100644 --- a/src/ui/constants/settings.js +++ b/src/ui/constants/settings.js @@ -6,6 +6,7 @@ export const EMAIL_COLLECTION_ACKNOWLEDGED = 'email_collection_acknowledged'; export const INVITE_ACKNOWLEDGED = 'invite_acknowledged'; export const LANGUAGE = 'language'; export const SHOW_MATURE = 'show_mature'; +export const SHOW_ANONYMOUS = 'show_anonymous'; export const SHOW_UNAVAILABLE = 'show_unavailable'; export const INSTANT_PURCHASE_ENABLED = 'instant_purchase_enabled'; export const INSTANT_PURCHASE_MAX = 'instant_purchase_max'; diff --git a/src/ui/page/settings/index.js b/src/ui/page/settings/index.js index 7de1c56b1..2f2d4bead 100644 --- a/src/ui/page/settings/index.js +++ b/src/ui/page/settings/index.js @@ -10,6 +10,7 @@ import SettingsPage from './view'; const select = state => ({ daemonSettings: selectDaemonSettings(state), showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state), + showAnonymous: makeSelectClientSetting(SETTINGS.SHOW_ANONYMOUS)(state), instantPurchaseEnabled: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state), instantPurchaseMax: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state), currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state), diff --git a/src/ui/page/settings/view.jsx b/src/ui/page/settings/view.jsx index d744158f8..63f885eaf 100644 --- a/src/ui/page/settings/view.jsx +++ b/src/ui/page/settings/view.jsx @@ -46,6 +46,7 @@ type Props = { clearCache: () => Promise, daemonSettings: DaemonSettings, showNsfw: boolean, + showAnonymous: boolean, instantPurchaseEnabled: boolean, instantPurchaseMax: Price, currentTheme: string, @@ -190,6 +191,7 @@ class SettingsPage extends React.PureComponent { const { daemonSettings, showNsfw, + showAnonymous, instantPurchaseEnabled, instantPurchaseMax, currentTheme, @@ -383,6 +385,17 @@ class SettingsPage extends React.PureComponent { )} /> + setClientSetting(SETTINGS.SHOW_ANONYMOUS, !showAnonymous)} + checked={showAnonymous} + label={__('Show anonymous content')} + helper={__( + 'You can opt for displaying contents published anonymously, i.e. contents published without a channel identity.' + )} + /> + // refactor me export const selectShowMatureContent = makeSelectClientSetting(SETTINGS.SHOW_MATURE); +export const selectShowAnonymousContent = makeSelectClientSetting(SETTINGS.SHOW_ANONYMOUS); export const selectTheme = makeSelectClientSetting(SETTINGS.THEME); export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED); diff --git a/static/app-strings.json b/static/app-strings.json index 13d64047d..9f7094384 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -805,4 +805,4 @@ "(Only available on the desktop app.)": "(Only available on the desktop app.)", "If we have your email address, we will send you notifications related to new content. You may configure these emails from the Help page.": "If we have your email address, we will send you notifications related to new content. You may configure these emails from the Help page.", "Light": "Light" -} \ No newline at end of file +}