add option to hide anonymous content
This commit is contained in:
parent
e83ccc77e2
commit
a1dfc54c3d
8 changed files with 26 additions and 5 deletions
|
@ -15,7 +15,7 @@ import {
|
||||||
doPrepareEdit,
|
doPrepareEdit,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
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 { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
||||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||||
import { push } from 'connected-react-router';
|
import { push } from 'connected-react-router';
|
||||||
|
@ -26,6 +26,7 @@ const select = (state, props) => ({
|
||||||
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
||||||
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||||
obscureNsfw: !selectShowMatureContent(state),
|
obscureNsfw: !selectShowMatureContent(state),
|
||||||
|
hideAnonymous: !selectShowAnonymousContent(state),
|
||||||
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
||||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||||
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
|
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
|
||||||
|
|
|
@ -22,6 +22,7 @@ type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
claim: ?Claim,
|
claim: ?Claim,
|
||||||
obscureNsfw: boolean,
|
obscureNsfw: boolean,
|
||||||
|
hideAnonymous: boolean,
|
||||||
showUserBlocked: boolean,
|
showUserBlocked: boolean,
|
||||||
claimIsMine: boolean,
|
claimIsMine: boolean,
|
||||||
pending?: boolean,
|
pending?: boolean,
|
||||||
|
@ -54,6 +55,7 @@ type Props = {
|
||||||
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
const {
|
const {
|
||||||
obscureNsfw,
|
obscureNsfw,
|
||||||
|
hideAnonymous,
|
||||||
claimIsMine,
|
claimIsMine,
|
||||||
pending,
|
pending,
|
||||||
history,
|
history,
|
||||||
|
@ -99,8 +101,9 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
const isChannel = isValid ? parseURI(uri).isChannel : false;
|
const isChannel = isValid ? parseURI(uri).isChannel : false;
|
||||||
const includeChannelTooltip = type !== 'inline' && type !== 'tooltip' && !isChannel;
|
const includeChannelTooltip = type !== 'inline' && type !== 'tooltip' && !isChannel;
|
||||||
const signingChannel = claim && claim.signing_channel;
|
const signingChannel = claim && claim.signing_channel;
|
||||||
let shouldHide =
|
const isAnonymous = !isChannel && !signingChannel;
|
||||||
placeholder !== 'loading' && ((abandoned && !showPublishLink) || (!claimIsMine && obscureNsfw && nsfw));
|
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
|
// This will be replaced once blocking is done at the wallet server level
|
||||||
if (claim && !shouldHide && blackListedOutpoints) {
|
if (claim && !shouldHide && blackListedOutpoints) {
|
||||||
|
@ -125,7 +128,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
}
|
}
|
||||||
// block channel claims if we can't control for them in claim search
|
// block channel claims if we can't control for them in claim search
|
||||||
// e.g. fetchRecommendedSubscriptions
|
// 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);
|
shouldHide = blockedChannelUris.some(blockedUri => blockedUri === claim.permanent_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ export const EMAIL_COLLECTION_ACKNOWLEDGED = 'email_collection_acknowledged';
|
||||||
export const INVITE_ACKNOWLEDGED = 'invite_acknowledged';
|
export const INVITE_ACKNOWLEDGED = 'invite_acknowledged';
|
||||||
export const LANGUAGE = 'language';
|
export const LANGUAGE = 'language';
|
||||||
export const SHOW_MATURE = 'show_mature';
|
export const SHOW_MATURE = 'show_mature';
|
||||||
|
export const SHOW_ANONYMOUS = 'show_anonymous';
|
||||||
export const SHOW_UNAVAILABLE = 'show_unavailable';
|
export const SHOW_UNAVAILABLE = 'show_unavailable';
|
||||||
export const INSTANT_PURCHASE_ENABLED = 'instant_purchase_enabled';
|
export const INSTANT_PURCHASE_ENABLED = 'instant_purchase_enabled';
|
||||||
export const INSTANT_PURCHASE_MAX = 'instant_purchase_max';
|
export const INSTANT_PURCHASE_MAX = 'instant_purchase_max';
|
||||||
|
|
|
@ -10,6 +10,7 @@ import SettingsPage from './view';
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
daemonSettings: selectDaemonSettings(state),
|
daemonSettings: selectDaemonSettings(state),
|
||||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
|
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
|
||||||
|
showAnonymous: makeSelectClientSetting(SETTINGS.SHOW_ANONYMOUS)(state),
|
||||||
instantPurchaseEnabled: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state),
|
instantPurchaseEnabled: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state),
|
||||||
instantPurchaseMax: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state),
|
instantPurchaseMax: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state),
|
||||||
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
|
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
|
||||||
|
|
|
@ -46,6 +46,7 @@ type Props = {
|
||||||
clearCache: () => Promise<any>,
|
clearCache: () => Promise<any>,
|
||||||
daemonSettings: DaemonSettings,
|
daemonSettings: DaemonSettings,
|
||||||
showNsfw: boolean,
|
showNsfw: boolean,
|
||||||
|
showAnonymous: boolean,
|
||||||
instantPurchaseEnabled: boolean,
|
instantPurchaseEnabled: boolean,
|
||||||
instantPurchaseMax: Price,
|
instantPurchaseMax: Price,
|
||||||
currentTheme: string,
|
currentTheme: string,
|
||||||
|
@ -190,6 +191,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
const {
|
const {
|
||||||
daemonSettings,
|
daemonSettings,
|
||||||
showNsfw,
|
showNsfw,
|
||||||
|
showAnonymous,
|
||||||
instantPurchaseEnabled,
|
instantPurchaseEnabled,
|
||||||
instantPurchaseMax,
|
instantPurchaseMax,
|
||||||
currentTheme,
|
currentTheme,
|
||||||
|
@ -383,6 +385,17 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
type="checkbox"
|
||||||
|
name="show_anonymous"
|
||||||
|
onChange={() => 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.'
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="show_nsfw"
|
name="show_nsfw"
|
||||||
|
|
|
@ -36,6 +36,7 @@ const defaultState = {
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
[SETTINGS.SHOW_MATURE]: false,
|
[SETTINGS.SHOW_MATURE]: false,
|
||||||
|
[SETTINGS.SHOW_ANONYMOUS]: true,
|
||||||
[SETTINGS.AUTOPLAY]: true,
|
[SETTINGS.AUTOPLAY]: true,
|
||||||
[SETTINGS.FLOATING_PLAYER]: true,
|
[SETTINGS.FLOATING_PLAYER]: true,
|
||||||
[SETTINGS.AUTO_DOWNLOAD]: true,
|
[SETTINGS.AUTO_DOWNLOAD]: true,
|
||||||
|
|
|
@ -26,6 +26,7 @@ export const makeSelectClientSetting = setting =>
|
||||||
|
|
||||||
// refactor me
|
// refactor me
|
||||||
export const selectShowMatureContent = makeSelectClientSetting(SETTINGS.SHOW_MATURE);
|
export const selectShowMatureContent = makeSelectClientSetting(SETTINGS.SHOW_MATURE);
|
||||||
|
export const selectShowAnonymousContent = makeSelectClientSetting(SETTINGS.SHOW_ANONYMOUS);
|
||||||
|
|
||||||
export const selectTheme = makeSelectClientSetting(SETTINGS.THEME);
|
export const selectTheme = makeSelectClientSetting(SETTINGS.THEME);
|
||||||
export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED);
|
export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED);
|
||||||
|
|
|
@ -805,4 +805,4 @@
|
||||||
"(Only available on the desktop app.)": "(Only available on the desktop app.)",
|
"(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.",
|
"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"
|
"Light": "Light"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue