The fixes never end #1519

Merged
neb-b merged 6 commits from release-blockers into master 2018-06-01 20:32:48 +02:00
14 changed files with 448 additions and 721 deletions

View file

@ -37,6 +37,7 @@
"jsx-a11y/label-has-for": 0, "jsx-a11y/label-has-for": 0,
"import/prefer-default-export": 0, "import/prefer-default-export": 0,
"no-return-assign": 0, "no-return-assign": 0,
"react/require-default-props": 0 "react/require-default-props": 0,
"react/jsx-closing-tag-location": 0
} }
neb-b commented 2018-06-01 16:52:58 +02:00 (Migrated from github.com)
Review

This is handled by prettier

This is handled by prettier
} }

View file

@ -48,7 +48,7 @@
"formik": "^0.10.4", "formik": "^0.10.4",
"hast-util-sanitize": "^1.1.2", "hast-util-sanitize": "^1.1.2",
"keytar": "^4.2.1", "keytar": "^4.2.1",
"lbry-redux": "lbryio/lbry-redux#fb27fb66387043be1b7962cd9439845fa73d7d8e", "lbry-redux": "lbryio/lbry-redux#a32e8835c238c0ba1081fe6979763c5b0fade76c",
"localforage": "^1.7.1", "localforage": "^1.7.1",
"mixpanel-browser": "^2.17.1", "mixpanel-browser": "^2.17.1",
"moment": "^2.22.0", "moment": "^2.22.0",

View file

@ -19,7 +19,6 @@ class ExternalLink extends React.PureComponent<Props> {
createLink() { createLink() {
const { href, title, children, openModal, navigate } = this.props; const { href, title, children, openModal, navigate } = this.props;
console.info(href);
// Regex for url protocol // Regex for url protocol
const protocolRegex = new RegExp('^(https?|lbry)+:', 'i'); const protocolRegex = new RegExp('^(https?|lbry)+:', 'i');

View file

@ -10,6 +10,7 @@ import FileSelector from 'component/common/file-selector';
import { COPYRIGHT, OTHER } from 'constants/licenses'; import { COPYRIGHT, OTHER } from 'constants/licenses';
import { CHANNEL_NEW, CHANNEL_ANONYMOUS, MINIMUM_PUBLISH_BID } from 'constants/claim'; import { CHANNEL_NEW, CHANNEL_ANONYMOUS, MINIMUM_PUBLISH_BID } from 'constants/claim';
import * as icons from 'constants/icons'; import * as icons from 'constants/icons';
import type { Claim } from 'types/claim';
import BidHelpText from './internal/bid-help-text'; import BidHelpText from './internal/bid-help-text';
import LicenseType from './internal/license-type'; import LicenseType from './internal/license-type';
@ -29,8 +30,6 @@ type Props = {
currency: string, currency: string,
}, },
channel: string, channel: string,
channelId: ?string,
myChannels: Array<{ name: string }>,
name: ?string, name: ?string,
tosAccepted: boolean, tosAccepted: boolean,
updatePublishForm: UpdatePublishFormData => void, updatePublishForm: UpdatePublishFormData => void,
@ -38,14 +37,7 @@ type Props = {
nameError: ?string, nameError: ?string,
isResolvingUri: boolean, isResolvingUri: boolean,
winningBidForClaimUri: number, winningBidForClaimUri: number,
myClaimForUri: ?{ myClaimForUri: ?Claim,
amount: number,
value: {
stream: {
source: { source: string },
},
},
},
licenseType: string, licenseType: string,
otherLicenseDescription: ?string, otherLicenseDescription: ?string,
licenseUrl: ?string, licenseUrl: ?string,
@ -57,7 +49,7 @@ type Props = {
clearPublish: () => void, clearPublish: () => void,
resolveUri: string => void, resolveUri: string => void,
scrollToTop: () => void, scrollToTop: () => void,
prepareEdit: ({}, uri) => void, prepareEdit: ({}, string) => void,
}; };
class PublishForm extends React.PureComponent<Props> { class PublishForm extends React.PureComponent<Props> {
@ -139,10 +131,9 @@ class PublishForm extends React.PureComponent<Props> {
} }
handleChannelChange(channelName: string) { handleChannelChange(channelName: string) {
const { name, updatePublishForm, myChannels } = this.props; const { name, updatePublishForm } = this.props;
const form = { channel: channelName }; const form = { channel: channelName };
const namedChannelClaim = myChannels.find(channel => channel.name === channelName);
form.channelId = namedChannelClaim ? namedChannelClaim.claim_id : '';
if (name) { if (name) {
form.uri = this.getNewUri(name, channelName); form.uri = this.getNewUri(name, channelName);
} }
@ -186,7 +177,6 @@ class PublishForm extends React.PureComponent<Props> {
description, description,
language, language,
nsfw, nsfw,
channelId,
licenseType, licenseType,
licenseUrl, licenseUrl,
otherLicenseDescription, otherLicenseDescription,
@ -196,6 +186,7 @@ class PublishForm extends React.PureComponent<Props> {
price, price,
uri, uri,
myClaimForUri, myClaimForUri,
channel,
} = this.props; } = this.props;
let publishingLicense; let publishingLicense;
@ -220,7 +211,6 @@ class PublishForm extends React.PureComponent<Props> {
description, description,
language, language,
nsfw, nsfw,
channelId,
license: publishingLicense, license: publishingLicense,
licenseUrl: publishingLicenseUrl, licenseUrl: publishingLicenseUrl,
otherLicenseDescription, otherLicenseDescription,
@ -229,6 +219,7 @@ class PublishForm extends React.PureComponent<Props> {
contentIsFree, contentIsFree,
price, price,
uri, uri,
channel,
}; };
// Editing a claim // Editing a claim
@ -303,7 +294,13 @@ class PublishForm extends React.PureComponent<Props> {
const formDisabled = (!filePath && !editingURI) || publishing; const formDisabled = (!filePath && !editingURI) || publishing;
const formValid = this.checkIsFormValid(); const formValid = this.checkIsFormValid();
const simpleUri = uri && uri.split('#')[0]; // The user could be linked from lbry://@channel... or lbry://claim-name...
// If a channel exists, we need to make sure it is added to the uri for proper edit handling
// If this isn't an edit, just use the pregenerated uri
const simpleUri = myClaimForUri
? buildURI({ channelName: myClaimForUri.channel_name, contentName: myClaimForUri.name })
: uri;
const isStillEditing = editingURI === simpleUri; const isStillEditing = editingURI === simpleUri;
let submitLabel; let submitLabel;
if (isStillEditing) { if (isStillEditing) {

View file

@ -195,7 +195,10 @@ class Video extends React.PureComponent<Props> {
style={layoverStyle} style={layoverStyle}
> >
<VideoPlayButton <VideoPlayButton
play={this.playContent} play={e => {
e.stopPropagation();
this.playContent();
}}
fileInfo={fileInfo} fileInfo={fileInfo}
uri={uri} uri={uri}
isLoading={isLoading} isLoading={isLoading}

View file

@ -56,7 +56,7 @@ export class Modal extends React.PureComponent<ModalProps> {
return ( return (
<ReactModal <ReactModal
{...modalProps} {...modalProps}
onCloseRequested={onAborted || onConfirmed} onRequestClose={onAborted || onConfirmed}
className={classnames(className, { className={classnames(className, {
modal: !fullScreen, modal: !fullScreen,
'modal--fullscreen': fullScreen, 'modal--fullscreen': fullScreen,

View file

@ -3,6 +3,12 @@ import FilePrice from 'component/filePrice';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
class ModalAffirmPurchase extends React.PureComponent { class ModalAffirmPurchase extends React.PureComponent {
constructor() {
super();
this.onAffirmPurchase = this.onAffirmPurchase.bind(this);
}
onAffirmPurchase() { onAffirmPurchase() {
this.props.closeModal(); this.props.closeModal();
this.props.loadVideo(this.props.uri); this.props.loadVideo(this.props.uri);
@ -20,7 +26,7 @@ class ModalAffirmPurchase extends React.PureComponent {
type="confirm" type="confirm"
isOpen isOpen
contentLabel={__('Confirm Purchase')} contentLabel={__('Confirm Purchase')}
onConfirmed={this.onAffirmPurchase.bind(this)} onConfirmed={this.onAffirmPurchase}
onAborted={cancelPurchase} onAborted={cancelPurchase}
> >
{__('This will purchase')} <strong>{title}</strong> {__('for')}{' '} {__('This will purchase')} <strong>{title}</strong> {__('for')}{' '}

View file

@ -1,12 +1,18 @@
// I'll come back to this // @flow
/* esline-disable */
import React from 'react'; import React from 'react';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import CurrencySymbol from 'component/common/lbc-symbol'; import CurrencySymbol from 'component/common/lbc-symbol';
import CreditAmount from 'component/common/credit-amount'; import CreditAmount from 'component/common/credit-amount';
import Button from 'component/button'; import Button from 'component/button';
const ModalCreditIntro = props => { type Props = {
totalRewardValue: number,
currentBalance: number,
closeModal: () => void,
addBalance: () => void,
};
const ModalCreditIntro = (props: Props) => {
const { closeModal, totalRewardValue, currentBalance, addBalance } = props; const { closeModal, totalRewardValue, currentBalance, addBalance } = props;
const totalRewardRounded = Math.round(totalRewardValue / 10) * 10; const totalRewardRounded = Math.round(totalRewardValue / 10) * 10;
@ -25,7 +31,7 @@ const ModalCreditIntro = props => {
can take are limited. can take are limited.
</p> </p>
)} )}
{totalRewardValue && ( {Boolean(totalRewardValue) && (
<p> <p>
There are a variety of ways to get credits, including more than{' '} There are a variety of ways to get credits, including more than{' '}
<CreditAmount noStyle amount={totalRewardRounded} />{' '} <CreditAmount noStyle amount={totalRewardRounded} />{' '}
@ -46,4 +52,3 @@ const ModalCreditIntro = props => {
}; };
export default ModalCreditIntro; export default ModalCreditIntro;
/* esline-enable */

View file

@ -6,7 +6,6 @@ import {
makeSelectFetchingChannelClaims, makeSelectFetchingChannelClaims,
makeSelectCurrentParam, makeSelectCurrentParam,
selectCurrentParams, selectCurrentParams,
doNotify,
} from 'lbry-redux'; } from 'lbry-redux';
import { doNavigate } from 'redux/actions/navigation'; import { doNavigate } from 'redux/actions/navigation';
import { makeSelectTotalPagesForChannel } from 'redux/selectors/content'; import { makeSelectTotalPagesForChannel } from 'redux/selectors/content';
@ -25,7 +24,6 @@ const perform = dispatch => ({
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)), fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
fetchClaimCount: uri => dispatch(doFetchClaimCountByChannel(uri)), fetchClaimCount: uri => dispatch(doFetchClaimCountByChannel(uri)),
navigate: (path, params) => dispatch(doNavigate(path, params)), navigate: (path, params) => dispatch(doNavigate(path, params)),
openModal: (modal, props) => dispatch(doNotify(modal, props)),
}); });
export default connect(select, perform)(ChannelPage); export default connect(select, perform)(ChannelPage);

View file

@ -1,7 +1,6 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import BusyIndicator from 'component/common/busy-indicator'; import BusyIndicator from 'component/common/busy-indicator';
import Button from 'component/button';
import { FormField, FormRow } from 'component/common/form'; import { FormField, FormRow } from 'component/common/form';
import ReactPaginate from 'react-paginate'; import ReactPaginate from 'react-paginate';
import SubscribeButton from 'component/subscribeButton'; import SubscribeButton from 'component/subscribeButton';
@ -9,7 +8,6 @@ import ViewOnWebButton from 'component/viewOnWebButton';
import Page from 'component/page'; import Page from 'component/page';
import FileList from 'component/fileList'; import FileList from 'component/fileList';
import type { Claim } from 'types/claim'; import type { Claim } from 'types/claim';
import { MODALS } from 'lbry-redux';
type Props = { type Props = {
uri: string, uri: string,
@ -22,7 +20,6 @@ type Props = {
fetchClaims: (string, number) => void, fetchClaims: (string, number) => void,
fetchClaimCount: string => void, fetchClaimCount: string => void,
navigate: (string, {}) => void, navigate: (string, {}) => void,
openModal: (string, {}) => void,
}; };
class ChannelPage extends React.PureComponent<Props> { class ChannelPage extends React.PureComponent<Props> {
@ -51,16 +48,23 @@ class ChannelPage extends React.PureComponent<Props> {
this.props.navigate('/show', newParams); this.props.navigate('/show', newParams);
} }
paginate(e, totalPages) { paginate(e, totalPages: number) {
// Change page if enter was pressed, and the given page is between // Change page if enter was pressed, and the given page is between
// the first and the last. // the first and the last.
if (e.keyCode === 13 && e.target.value > 0 && e.target.value <= totalPages) { const pageFromInput = Number(e.target.value);
this.changePage(e.target.value);
if (
e.keyCode === 13 &&
!Number.isNaN(pageFromInput) &&
pageFromInput > 0 &&
pageFromInput <= totalPages
) {
this.changePage(pageFromInput);
} }
} }
render() { render() {
const { fetching, claimsInChannel, claim, page, totalPages, uri, openModal } = this.props; const { fetching, claimsInChannel, claim, page, totalPages } = this.props;
const { name, permanent_url: permanentUrl, claim_id: claimId } = claim; const { name, permanent_url: permanentUrl, claim_id: claimId } = claim;
let contentList; let contentList;
@ -80,12 +84,6 @@ class ChannelPage extends React.PureComponent<Props> {
<section className="card__channel-info card__channel-info--large"> <section className="card__channel-info card__channel-info--large">
<h1>{name}</h1> <h1>{name}</h1>
<div className="card__actions card__actions--no-margin"> <div className="card__actions card__actions--no-margin">
<Button
button="alt"
iconRight="Send"
label={__('Enjoy this? Send a tip')}
onClick={() => openModal(MODALS.SEND_TIP, { uri })}
/>
<SubscribeButton uri={permanentUrl} channelName={name} /> <SubscribeButton uri={permanentUrl} channelName={name} />
<ViewOnWebButton uri={`${name}:${claimId}`} /> <ViewOnWebButton uri={`${name}:${claimId}`} />
</div> </div>

View file

@ -33,8 +33,6 @@ type Props = {
uri: string, uri: string,
rewardedContentClaimIds: Array<string>, rewardedContentClaimIds: Array<string>,
obscureNsfw: boolean, obscureNsfw: boolean,
playingUri: ?string,
isPaused: boolean,
claimIsMine: boolean, claimIsMine: boolean,
autoplay: boolean, autoplay: boolean,
costInfo: ?{}, costInfo: ?{},
@ -103,8 +101,6 @@ class FilePage extends React.Component<Props> {
uri, uri,
rewardedContentClaimIds, rewardedContentClaimIds,
obscureNsfw, obscureNsfw,
playingUri,
isPaused,
openModal, openModal,
claimIsMine, claimIsMine,
prepareEdit, prepareEdit,
@ -141,7 +137,6 @@ class FilePage extends React.Component<Props> {
editUri = buildURI({ channelName, contentName: claim.name }); editUri = buildURI({ channelName, contentName: claim.name });
} }
const isPlaying = playingUri === uri && !isPaused;
return ( return (
<Page extraPadding> <Page extraPadding>
{!claim || !metadata ? ( {!claim || !metadata ? (

View file

@ -1,26 +1,20 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doClaimRewardType } from 'redux/actions/rewards';
import { import {
doHistoryBack,
doResolveUri, doResolveUri,
makeSelectCostInfoForUri, makeSelectCostInfoForUri,
selectMyClaims, selectMyClaims,
selectFetchingMyChannels,
selectMyChannelClaims,
selectClaimsByUri, selectClaimsByUri,
selectResolvingUris, selectResolvingUris,
selectBalance, selectBalance,
} from 'lbry-redux'; } from 'lbry-redux';
import {
doFetchClaimListMine,
doFetchChannelListMine,
doCreateChannel,
} from 'redux/actions/content';
import { doNavigate } from 'redux/actions/navigation'; import { doNavigate } from 'redux/actions/navigation';
import rewards from 'rewards';
import { selectPublishFormValues } from 'redux/selectors/publish'; import { selectPublishFormValues } from 'redux/selectors/publish';
import { doClearPublish, doUpdatePublishForm, doPublish } from 'redux/actions/publish'; import {
import { doPrepareEdit } from 'redux/actions/publish'; doClearPublish,
doUpdatePublishForm,
doPublish,
doPrepareEdit,
} from 'redux/actions/publish';
import PublishPage from './view'; import PublishPage from './view';
const select = (state, props) => { const select = (state, props) => {
@ -35,7 +29,6 @@ const select = (state, props) => {
const claimsByUri = selectClaimsByUri(state); const claimsByUri = selectClaimsByUri(state);
const myClaims = selectMyClaims(state); const myClaims = selectMyClaims(state);
const myChannels = selectMyChannelClaims(state);
const claimForUri = claimsByUri[uri]; const claimForUri = claimsByUri[uri];
let winningBidForClaimUri; let winningBidForClaimUri;
@ -51,7 +44,6 @@ const select = (state, props) => {
claimForUri, claimForUri,
winningBidForClaimUri, winningBidForClaimUri,
myClaimForUri, myClaimForUri,
myChannels,
costInfo: makeSelectCostInfoForUri(props.uri)(state), costInfo: makeSelectCostInfoForUri(props.uri)(state),
balance: selectBalance(state), balance: selectBalance(state),
}; };

View file

@ -1,5 +1,12 @@
// @flow // @flow
import { ACTIONS, Lbry, selectMyClaimsWithoutChannels, doNotify, MODALS } from 'lbry-redux'; import {
ACTIONS,
Lbry,
selectMyClaimsWithoutChannels,
doNotify,
MODALS,
selectMyChannelClaims,
} from 'lbry-redux';
import { selectPendingPublishes } from 'redux/selectors/publish'; import { selectPendingPublishes } from 'redux/selectors/publish';
import type { import type {
UpdatePublishFormData, UpdatePublishFormData,
@ -73,6 +80,7 @@ export const doPrepareEdit = (claim: any, uri: string) => (dispatch: Dispatch) =
export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getState: () => {}) => { export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getState: () => {}) => {
const state = getState(); const state = getState();
const myClaims = selectMyClaimsWithoutChannels(state); const myClaims = selectMyClaimsWithoutChannels(state);
const myChannels = selectMyChannelClaims(state);
const { const {
name, name,
@ -85,7 +93,6 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
thumbnail, thumbnail,
nsfw, nsfw,
channel, channel,
channelId,
title, title,
contentIsFree, contentIsFree,
price, price,
@ -93,6 +100,10 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
sources, sources,
} = params; } = params;
// get the claim id from the channel name, we will use that instead
const namedChannelClaim = myChannels.find(myChannel => myChannel.name === channel);
const channelId = namedChannelClaim ? namedChannelClaim.claim_id : '';
let isEdit; let isEdit;
const newPublishName = channel ? `${channel}/${name}` : name; const newPublishName = channel ? `${channel}/${name}` : name;
for (let i = 0; i < myClaims.length; i += 1) { for (let i = 0; i < myClaims.length; i += 1) {

1036
yarn.lock

File diff suppressed because it is too large Load diff