From ed0f574339dae8a82304fb716cf6c5658d254c43 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Tue, 25 Jan 2022 13:48:53 -0500 Subject: [PATCH] Respect disable download button tag Fixes https://github.com/OdyseeTeam/odysee-frontend/issues/742 --- ui/component/fileActions/index.js | 3 +++ ui/component/fileActions/view.jsx | 4 +++- ui/constants/tags.js | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/component/fileActions/index.js b/ui/component/fileActions/index.js index ac301ccf0..d682a4a24 100644 --- a/ui/component/fileActions/index.js +++ b/ui/component/fileActions/index.js @@ -4,6 +4,7 @@ import { selectClaimForUri, selectHasChannels, selectIsStreamPlaceholderForUri, + makeSelectTagInClaimOrChannelForUri, } from 'redux/selectors/claims'; import { makeSelectStreamingUrlForUri, makeSelectFileInfoForUri } from 'redux/selectors/file_info'; import { doPrepareEdit } from 'redux/actions/publish'; @@ -14,6 +15,7 @@ import { doOpenModal, doSetActiveChannel, doSetIncognito, doAnalyticsView } from import fs from 'fs'; import FileActions from './view'; import { makeSelectFileRenderModeForUri } from 'redux/selectors/content'; +import { DISABLE_DOWNLOAD_BUTTON_TAG } from 'constants/tags'; const select = (state, props) => { const claim = selectClaimForUri(state, props.uri); @@ -27,6 +29,7 @@ const select = (state, props) => { hasChannels: selectHasChannels(state), isLivestreamClaim: selectIsStreamPlaceholderForUri(state, props.uri), streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state), + disableDownloadButton: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_DOWNLOAD_BUTTON_TAG)(state), }; }; diff --git a/ui/component/fileActions/view.jsx b/ui/component/fileActions/view.jsx index 13101faf4..45c567359 100644 --- a/ui/component/fileActions/view.jsx +++ b/ui/component/fileActions/view.jsx @@ -34,6 +34,7 @@ type Props = { isLivestreamClaim: boolean, download: (string) => void, streamingUrl: ?string, + disableDownloadButton: boolean, }; function FileActions(props: Props) { @@ -53,6 +54,7 @@ function FileActions(props: Props) { isLivestreamClaim, download, streamingUrl, + disableDownloadButton, } = props; const { push, @@ -178,7 +180,7 @@ function FileActions(props: Props) { {/* @if TARGET='web' */} - {!isLivestreamClaim && ( + {!isLivestreamClaim && !disableDownloadButton && (
diff --git a/ui/constants/tags.js b/ui/constants/tags.js index 0a24ffa62..adab01b8d 100644 --- a/ui/constants/tags.js +++ b/ui/constants/tags.js @@ -20,9 +20,10 @@ export const DISABLE_SUPPORT_TAG = 'disable-support'; export const PREFERENCE_EMBED = 'c:preference-embed'; export const SCHEDULED_LIVESTREAM_TAG = 'c:scheduled-livestream'; 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. -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. export const SYSTEM_TAGS = [SCHEDULED_LIVESTREAM_TAG, LBRY_FIRST_TAG];