From 9a247d3c9ffd4e6473763a1356ddbc3ebd0302d5 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 19 May 2022 17:39:09 -0400 Subject: [PATCH] Mature fixes --- ui/component/fileActions/index.js | 4 +++- ui/component/fileActions/view.jsx | 4 +++- ui/component/socialShare/index.js | 10 +++++++++- ui/component/socialShare/view.jsx | 8 +++++++- ui/page/file/view.jsx | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ui/component/fileActions/index.js b/ui/component/fileActions/index.js index 4062a3b20..38eb6a723 100644 --- a/ui/component/fileActions/index.js +++ b/ui/component/fileActions/index.js @@ -4,6 +4,7 @@ import { selectClaimForUri, selectHasChannels, makeSelectTagInClaimOrChannelForUri, + selectClaimIsNsfwForUri, } from 'redux/selectors/claims'; import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info'; import { doPrepareEdit } from 'redux/actions/publish'; @@ -29,7 +30,8 @@ const select = (state, props) => { hasChannels: selectHasChannels(state), isLivestreamClaim: isStreamPlaceholderClaim(claim), streamingUrl: makeSelectStreamingUrlForUri(uri)(state), - disableDownloadButton: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_DOWNLOAD_BUTTON_TAG)(state), + disableDownloadButton: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_DOWNLOAD_BUTTON_TAG)(state), + isMature: selectClaimIsNsfwForUri(state, uri), }; }; diff --git a/ui/component/fileActions/view.jsx b/ui/component/fileActions/view.jsx index 5e6f7271b..dff8123f8 100644 --- a/ui/component/fileActions/view.jsx +++ b/ui/component/fileActions/view.jsx @@ -34,6 +34,7 @@ type Props = { doPrepareEdit: (claim: Claim, uri: string) => void, doToast: (data: { message: string }) => void, doDownloadUri: (uri: string) => void, + isMature: boolean, }; export default function FileActions(props: Props) { @@ -52,6 +53,7 @@ export default function FileActions(props: Props) { doPrepareEdit, doToast, doDownloadUri, + isMature, } = props; const { @@ -221,7 +223,7 @@ export default function FileActions(props: Props) { )} - {!isLivestreamClaim && !disableDownloadButton && ( + {!isLivestreamClaim && !disableDownloadButton && !isMature && (
diff --git a/ui/component/socialShare/index.js b/ui/component/socialShare/index.js index 38f6b27e9..f7a7a072c 100644 --- a/ui/component/socialShare/index.js +++ b/ui/component/socialShare/index.js @@ -1,9 +1,15 @@ import { connect } from 'react-redux'; import { doFetchInviteStatus } from 'redux/actions/user'; -import { selectClaimForUri, selectTitleForUri } from 'redux/selectors/claims'; +import { + selectClaimForUri, + selectTitleForUri, + makeSelectTagInClaimOrChannelForUri, + selectClaimIsNsfwForUri, +} from 'redux/selectors/claims'; import SocialShare from './view'; import { selectUserInviteReferralCode, selectUser, selectUserInviteStatusFetched } from 'redux/selectors/user'; import { selectContentPositionForUri } from 'redux/selectors/content'; +import { DISABLE_DOWNLOAD_BUTTON_TAG } from 'constants/tags'; const select = (state, props) => { const { uri } = props; @@ -15,6 +21,8 @@ const select = (state, props) => { user: selectUser(state), title: selectTitleForUri(state, uri), position: selectContentPositionForUri(state, uri), + disableDownloadButton: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_DOWNLOAD_BUTTON_TAG)(state), + isMature: selectClaimIsNsfwForUri(state, uri), }; }; diff --git a/ui/component/socialShare/view.jsx b/ui/component/socialShare/view.jsx index a90a9217e..00bdca390 100644 --- a/ui/component/socialShare/view.jsx +++ b/ui/component/socialShare/view.jsx @@ -36,6 +36,8 @@ type Props = { position: number, collectionId?: number, doFetchInviteStatus: (boolean) => void, + disableDownloadButton: boolean, + isMature: boolean, }; function SocialShare(props: Props) { @@ -49,6 +51,8 @@ function SocialShare(props: Props) { position, collectionId, doFetchInviteStatus, + disableDownloadButton, + isMature, } = props; const [showEmbed, setShowEmbed] = React.useState(false); const [includeCollectionId, setIncludeCollectionId] = React.useState(Boolean(collectionId)); // unless it *is* a collection? @@ -245,7 +249,9 @@ function SocialShare(props: Props) { ))} {showClaimLinks && (
- {Boolean(isStream) && } + {Boolean(isStream) && !disableDownloadButton && !isMature && ( + + )} {Boolean(rssUrl) && } {Boolean(isChannel) && ( <> diff --git a/ui/page/file/view.jsx b/ui/page/file/view.jsx index 7f2fa57a7..366131814 100644 --- a/ui/page/file/view.jsx +++ b/ui/page/file/view.jsx @@ -156,7 +156,7 @@ export default function FilePage(props: Props) { ); } - if (RENDER_MODES.UNRENDERABLE_MODES.includes(renderMode)) { + if (RENDER_MODES.UNRENDERABLE_MODES.includes(renderMode) && !isMature) { return ( <>