Merge pull request #1519 from lbryio/release-blockers

The fixes never end
This commit is contained in:
Sean Yesmunt 2018-06-01 14:32:47 -04:00 committed by GitHub
commit 0cd5ef9ab4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 448 additions and 721 deletions

View file

@ -37,6 +37,7 @@
"jsx-a11y/label-has-for": 0,
"import/prefer-default-export": 0,
"no-return-assign": 0,
"react/require-default-props": 0
"react/require-default-props": 0,
"react/jsx-closing-tag-location": 0
}
}

View file

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

View file

@ -19,7 +19,6 @@ class ExternalLink extends React.PureComponent<Props> {
createLink() {
const { href, title, children, openModal, navigate } = this.props;
console.info(href);
// Regex for url protocol
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 { CHANNEL_NEW, CHANNEL_ANONYMOUS, MINIMUM_PUBLISH_BID } from 'constants/claim';
import * as icons from 'constants/icons';
import type { Claim } from 'types/claim';
import BidHelpText from './internal/bid-help-text';
import LicenseType from './internal/license-type';
@ -29,8 +30,6 @@ type Props = {
currency: string,
},
channel: string,
channelId: ?string,
myChannels: Array<{ name: string }>,
name: ?string,
tosAccepted: boolean,
updatePublishForm: UpdatePublishFormData => void,
@ -38,14 +37,7 @@ type Props = {
nameError: ?string,
isResolvingUri: boolean,
winningBidForClaimUri: number,
myClaimForUri: ?{
amount: number,
value: {
stream: {
source: { source: string },
},
},
},
myClaimForUri: ?Claim,
licenseType: string,
otherLicenseDescription: ?string,
licenseUrl: ?string,
@ -57,7 +49,7 @@ type Props = {
clearPublish: () => void,
resolveUri: string => void,
scrollToTop: () => void,
prepareEdit: ({}, uri) => void,
prepareEdit: ({}, string) => void,
};
class PublishForm extends React.PureComponent<Props> {
@ -139,10 +131,9 @@ class PublishForm extends React.PureComponent<Props> {
}
handleChannelChange(channelName: string) {
const { name, updatePublishForm, myChannels } = this.props;
const { name, updatePublishForm } = this.props;
const form = { channel: channelName };
const namedChannelClaim = myChannels.find(channel => channel.name === channelName);
form.channelId = namedChannelClaim ? namedChannelClaim.claim_id : '';
if (name) {
form.uri = this.getNewUri(name, channelName);
}
@ -186,7 +177,6 @@ class PublishForm extends React.PureComponent<Props> {
description,
language,
nsfw,
channelId,
licenseType,
licenseUrl,
otherLicenseDescription,
@ -196,6 +186,7 @@ class PublishForm extends React.PureComponent<Props> {
price,
uri,
myClaimForUri,
channel,
} = this.props;
let publishingLicense;
@ -220,7 +211,6 @@ class PublishForm extends React.PureComponent<Props> {
description,
language,
nsfw,
channelId,
license: publishingLicense,
licenseUrl: publishingLicenseUrl,
otherLicenseDescription,
@ -229,6 +219,7 @@ class PublishForm extends React.PureComponent<Props> {
contentIsFree,
price,
uri,
channel,
};
// Editing a claim
@ -303,7 +294,13 @@ class PublishForm extends React.PureComponent<Props> {
const formDisabled = (!filePath && !editingURI) || publishing;
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;
let submitLabel;
if (isStillEditing) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,12 @@
// @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 type {
UpdatePublishFormData,
@ -73,6 +80,7 @@ export const doPrepareEdit = (claim: any, uri: string) => (dispatch: Dispatch) =
export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getState: () => {}) => {
const state = getState();
const myClaims = selectMyClaimsWithoutChannels(state);
const myChannels = selectMyChannelClaims(state);
const {
name,
@ -85,7 +93,6 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
thumbnail,
nsfw,
channel,
channelId,
title,
contentIsFree,
price,
@ -93,6 +100,10 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
sources,
} = 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;
const newPublishName = channel ? `${channel}/${name}` : name;
for (let i = 0; i < myClaims.length; i += 1) {

1036
yarn.lock

File diff suppressed because it is too large Load diff