From ca1c95b0936a7dff47c85ee1e466b3c748008dd6 Mon Sep 17 00:00:00 2001 From: zxawry Date: Thu, 4 Jul 2019 12:23:22 +0100 Subject: [PATCH] do not show warning on own claims and lbry related links --- src/ui/component/externalLink/view.jsx | 6 +++++- src/ui/component/fileDownloadLink/index.js | 2 ++ src/ui/component/fileDownloadLink/view.jsx | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/ui/component/externalLink/view.jsx b/src/ui/component/externalLink/view.jsx index 23d34f90d..fcf5cbf4b 100644 --- a/src/ui/component/externalLink/view.jsx +++ b/src/ui/component/externalLink/view.jsx @@ -5,6 +5,7 @@ import * as React from 'react'; import { isURIValid } from 'lbry-redux'; import Button from 'component/button'; import ClaimLink from 'component/claimLink'; +import { isLBRYDomain } from 'util/uri'; type Props = { href: string, @@ -37,7 +38,10 @@ class ExternalLink extends React.PureComponent { title={title || href} label={children} className="button--external-link" - onClick={() => openModal(MODALS.CONFIRM_EXTERNAL_RESOURCE, { uri: href })} + onClick={() => { + const isTrusted = isLBRYDomain(href); + openModal(MODALS.CONFIRM_EXTERNAL_RESOURCE, { uri: href, isTrusted: isTrusted }); + }} /> ); } diff --git a/src/ui/component/fileDownloadLink/index.js b/src/ui/component/fileDownloadLink/index.js index b511885bc..719a6debd 100644 --- a/src/ui/component/fileDownloadLink/index.js +++ b/src/ui/component/fileDownloadLink/index.js @@ -4,6 +4,7 @@ import { makeSelectDownloadingForUri, makeSelectLoadingForUri, makeSelectClaimForUri, + makeSelectClaimIsMine, } from 'lbry-redux'; import { makeSelectCostInfoForUri } from 'lbryinc'; import { doOpenModal } from 'redux/actions/app'; @@ -17,6 +18,7 @@ const select = (state, props) => ({ costInfo: makeSelectCostInfoForUri(props.uri)(state), loading: makeSelectLoadingForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state), + claimIsMine: makeSelectClaimIsMine(props.uri)(state), }); const perform = dispatch => ({ diff --git a/src/ui/component/fileDownloadLink/view.jsx b/src/ui/component/fileDownloadLink/view.jsx index 307e6a5c7..35c1ab359 100644 --- a/src/ui/component/fileDownloadLink/view.jsx +++ b/src/ui/component/fileDownloadLink/view.jsx @@ -8,6 +8,7 @@ import analytics from 'analytics'; type Props = { claim: StreamClaim, + claimIsMine: boolean, uri: string, downloading: boolean, fileInfo: ?{ @@ -44,7 +45,18 @@ class FileDownloadLink extends React.PureComponent { uri: ?string; render() { - const { fileInfo, downloading, uri, openModal, purchaseUri, costInfo, loading, pause, claim } = this.props; + const { + fileInfo, + downloading, + uri, + openModal, + purchaseUri, + costInfo, + loading, + pause, + claim, + claimIsMine, + } = this.props; if (loading || downloading) { const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0; @@ -81,7 +93,7 @@ class FileDownloadLink extends React.PureComponent { icon={ICONS.EXTERNAL} onClick={() => { pause(); - openModal(MODALS.CONFIRM_EXTERNAL_RESOURCE, { path: fileInfo.download_path }); + openModal(MODALS.CONFIRM_EXTERNAL_RESOURCE, { path: fileInfo.download_path, isMine: claimIsMine }); }} />