do not show warning on own claims and lbry related links

This commit is contained in:
zxawry 2019-07-04 12:23:22 +01:00
parent e43ad2ce89
commit ca1c95b093
No known key found for this signature in database
GPG key ID: 70F5D1B4F51F051A
3 changed files with 21 additions and 3 deletions

View file

@ -5,6 +5,7 @@ import * as React from 'react';
import { isURIValid } from 'lbry-redux'; import { isURIValid } from 'lbry-redux';
import Button from 'component/button'; import Button from 'component/button';
import ClaimLink from 'component/claimLink'; import ClaimLink from 'component/claimLink';
import { isLBRYDomain } from 'util/uri';
type Props = { type Props = {
href: string, href: string,
@ -37,7 +38,10 @@ class ExternalLink extends React.PureComponent<Props> {
title={title || href} title={title || href}
label={children} label={children}
className="button--external-link" 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 });
}}
/> />
); );
} }

View file

@ -4,6 +4,7 @@ import {
makeSelectDownloadingForUri, makeSelectDownloadingForUri,
makeSelectLoadingForUri, makeSelectLoadingForUri,
makeSelectClaimForUri, makeSelectClaimForUri,
makeSelectClaimIsMine,
} from 'lbry-redux'; } from 'lbry-redux';
import { makeSelectCostInfoForUri } from 'lbryinc'; import { makeSelectCostInfoForUri } from 'lbryinc';
import { doOpenModal } from 'redux/actions/app'; import { doOpenModal } from 'redux/actions/app';
@ -17,6 +18,7 @@ const select = (state, props) => ({
costInfo: makeSelectCostInfoForUri(props.uri)(state), costInfo: makeSelectCostInfoForUri(props.uri)(state),
loading: makeSelectLoadingForUri(props.uri)(state), loading: makeSelectLoadingForUri(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({

View file

@ -8,6 +8,7 @@ import analytics from 'analytics';
type Props = { type Props = {
claim: StreamClaim, claim: StreamClaim,
claimIsMine: boolean,
uri: string, uri: string,
downloading: boolean, downloading: boolean,
fileInfo: ?{ fileInfo: ?{
@ -44,7 +45,18 @@ class FileDownloadLink extends React.PureComponent<Props> {
uri: ?string; uri: ?string;
render() { 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) { if (loading || downloading) {
const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0; const progress = fileInfo && fileInfo.written_bytes ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0;
@ -81,7 +93,7 @@ class FileDownloadLink extends React.PureComponent<Props> {
icon={ICONS.EXTERNAL} icon={ICONS.EXTERNAL}
onClick={() => { onClick={() => {
pause(); pause();
openModal(MODALS.CONFIRM_EXTERNAL_RESOURCE, { path: fileInfo.download_path }); openModal(MODALS.CONFIRM_EXTERNAL_RESOURCE, { path: fileInfo.download_path, isMine: claimIsMine });
}} }}
/> />
</ToolTip> </ToolTip>