Respect disable download button tag

Fixes https://github.com/OdyseeTeam/odysee-frontend/issues/742
This commit is contained in:
Thomas Zarebczan 2022-01-25 13:48:53 -05:00 committed by Thomas Zarebczan
parent a417cc3aca
commit ed0f574339
3 changed files with 8 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import {
selectClaimForUri, selectClaimForUri,
selectHasChannels, selectHasChannels,
selectIsStreamPlaceholderForUri, selectIsStreamPlaceholderForUri,
makeSelectTagInClaimOrChannelForUri,
} from 'redux/selectors/claims'; } from 'redux/selectors/claims';
import { makeSelectStreamingUrlForUri, makeSelectFileInfoForUri } from 'redux/selectors/file_info'; import { makeSelectStreamingUrlForUri, makeSelectFileInfoForUri } from 'redux/selectors/file_info';
import { doPrepareEdit } from 'redux/actions/publish'; import { doPrepareEdit } from 'redux/actions/publish';
@ -14,6 +15,7 @@ import { doOpenModal, doSetActiveChannel, doSetIncognito, doAnalyticsView } from
import fs from 'fs'; import fs from 'fs';
import FileActions from './view'; import FileActions from './view';
import { makeSelectFileRenderModeForUri } from 'redux/selectors/content'; import { makeSelectFileRenderModeForUri } from 'redux/selectors/content';
import { DISABLE_DOWNLOAD_BUTTON_TAG } from 'constants/tags';
const select = (state, props) => { const select = (state, props) => {
const claim = selectClaimForUri(state, props.uri); const claim = selectClaimForUri(state, props.uri);
@ -27,6 +29,7 @@ const select = (state, props) => {
hasChannels: selectHasChannels(state), hasChannels: selectHasChannels(state),
isLivestreamClaim: selectIsStreamPlaceholderForUri(state, props.uri), isLivestreamClaim: selectIsStreamPlaceholderForUri(state, props.uri),
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state), streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
disableDownloadButton: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_DOWNLOAD_BUTTON_TAG)(state),
}; };
}; };

View file

@ -34,6 +34,7 @@ type Props = {
isLivestreamClaim: boolean, isLivestreamClaim: boolean,
download: (string) => void, download: (string) => void,
streamingUrl: ?string, streamingUrl: ?string,
disableDownloadButton: boolean,
}; };
function FileActions(props: Props) { function FileActions(props: Props) {
@ -53,6 +54,7 @@ function FileActions(props: Props) {
isLivestreamClaim, isLivestreamClaim,
download, download,
streamingUrl, streamingUrl,
disableDownloadButton,
} = props; } = props;
const { const {
push, push,
@ -178,7 +180,7 @@ function FileActions(props: Props) {
</MenuButton> </MenuButton>
<MenuList className="menu__list"> <MenuList className="menu__list">
{/* @if TARGET='web' */} {/* @if TARGET='web' */}
{!isLivestreamClaim && ( {!isLivestreamClaim && !disableDownloadButton && (
<MenuItem className="comment__menu-option" onSelect={handleWebDownload}> <MenuItem className="comment__menu-option" onSelect={handleWebDownload}>
<div className="menu__link"> <div className="menu__link">
<Icon aria-hidden icon={ICONS.DOWNLOAD} /> <Icon aria-hidden icon={ICONS.DOWNLOAD} />

View file

@ -20,9 +20,10 @@ export const DISABLE_SUPPORT_TAG = 'disable-support';
export const PREFERENCE_EMBED = 'c:preference-embed'; export const PREFERENCE_EMBED = 'c:preference-embed';
export const SCHEDULED_LIVESTREAM_TAG = 'c:scheduled-livestream'; export const SCHEDULED_LIVESTREAM_TAG = 'c:scheduled-livestream';
export const LBRY_FIRST_TAG = 'c:lbry-first'; export const LBRY_FIRST_TAG = 'c:lbry-first';
export const DISABLE_DOWNLOAD_BUTTON_TAG = 'c:disable-download';
// Control tags are special tags that are available to the user in some situations. // Control tags are special tags that are available to the user in some situations.
export const CONTROL_TAGS = [DISABLE_COMMENTS_TAG, DISABLE_SUPPORT_TAG, PREFERENCE_EMBED]; export const CONTROL_TAGS = [DISABLE_COMMENTS_TAG, DISABLE_SUPPORT_TAG, PREFERENCE_EMBED, DISABLE_DOWNLOAD_BUTTON_TAG];
// System tags are special tags that are not available to the user. // System tags are special tags that are not available to the user.
export const SYSTEM_TAGS = [SCHEDULED_LIVESTREAM_TAG, LBRY_FIRST_TAG]; export const SYSTEM_TAGS = [SCHEDULED_LIVESTREAM_TAG, LBRY_FIRST_TAG];