Mature fixes
This commit is contained in:
parent
28b9e2a4d3
commit
9a247d3c9f
5 changed files with 23 additions and 5 deletions
|
@ -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),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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 && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleWebDownload}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DOWNLOAD} />
|
||||
|
|
|
@ -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),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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 && (
|
||||
<div className="section">
|
||||
{Boolean(isStream) && <CopyableText label={__('Download Link')} copyable={downloadUrl} />}
|
||||
{Boolean(isStream) && !disableDownloadButton && !isMature && (
|
||||
<CopyableText label={__('Download Link')} copyable={downloadUrl} />
|
||||
)}
|
||||
{Boolean(rssUrl) && <CopyableText label={__('RSS Url')} copyable={rssUrl} />}
|
||||
{Boolean(isChannel) && (
|
||||
<>
|
||||
|
|
|
@ -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 (
|
||||
<>
|
||||
<FileTitleSection uri={uri} />
|
||||
|
|
Loading…
Reference in a new issue