Merge pull request #2471 from lbryio/fix-mature-checkbox

moar release fixes
This commit is contained in:
Sean Yesmunt 2019-05-10 11:10:55 -04:00 committed by GitHub
commit d6c4463c99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 80 additions and 65 deletions

View file

@ -24,6 +24,7 @@
"rules": { "rules": {
"comma-dangle": ["error", "always-multiline"], "comma-dangle": ["error", "always-multiline"],
"handle-callback-err": 0, "handle-callback-err": 0,
"indent": 0,
"jsx-quotes": ["error", "prefer-double"], "jsx-quotes": ["error", "prefer-double"],
"new-cap": 0, "new-cap": 0,
"no-multi-spaces": 0, "no-multi-spaces": 0,

BIN
build/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

11
flow-typed/publish.js vendored
View file

@ -3,7 +3,7 @@
declare type UpdatePublishFormData = { declare type UpdatePublishFormData = {
filePath?: string, filePath?: string,
contentIsFree?: boolean, contentIsFree?: boolean,
price?: { fee?: {
amount: number, amount: number,
currency: string, currency: string,
}, },
@ -23,7 +23,7 @@ declare type UpdatePublishFormData = {
licenseUrl?: string, licenseUrl?: string,
licenseType?: string, licenseType?: string,
uri?: string, uri?: string,
replace?: boolean, nsfw: boolean,
}; };
declare type PublishParams = { declare type PublishParams = {
@ -43,12 +43,9 @@ declare type PublishParams = {
license: ?string, license: ?string,
licenseUrl: ?string, licenseUrl: ?string,
fee?: { fee?: {
amount: string,
currency: string, currency: string,
amount: number,
}, },
replace?: boolean, claim: StreamClaim,
// This is bad.
// Will be removed for tags soon
nsfw: boolean, nsfw: boolean,
}; };

View file

@ -117,7 +117,7 @@
"jsmediatags": "^3.8.1", "jsmediatags": "^3.8.1",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#32916b04e4888c06a9bb2b07c57ce6821a4acf1a", "lbry-redux": "lbryio/lbry-redux#c8126ab21792d7a85e1123a2363af285a0263654",
"lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845", "lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845",
"lint-staged": "^7.0.2", "lint-staged": "^7.0.2",
"localforage": "^1.7.1", "localforage": "^1.7.1",

View file

@ -1,4 +1,3 @@
import path from 'path';
import { app, BrowserWindow, dialog, shell, screen } from 'electron'; import { app, BrowserWindow, dialog, shell, screen } from 'electron';
import isDev from 'electron-is-dev'; import isDev from 'electron-is-dev';
import windowStateKeeper from 'electron-window-state'; import windowStateKeeper from 'electron-window-state';
@ -28,7 +27,7 @@ export default appState => {
// If state is undefined, create window as maximized. // If state is undefined, create window as maximized.
width: windowState.width === undefined ? width : windowState.width, width: windowState.width === undefined ? width : windowState.width,
height: windowState.height === undefined ? height : windowState.height, height: windowState.height === undefined ? height : windowState.height,
icon: 'static/img/tray/default/tray.png', icon: 'static/img/tray/windows/tray.png',
webPreferences: { webPreferences: {
// Disable renderer process's webSecurity on development to enable CORS. // Disable renderer process's webSecurity on development to enable CORS.
webSecurity: !isDev, webSecurity: !isDev,

View file

@ -28,7 +28,7 @@ type Props = {
language: string, language: string,
nsfw: boolean, nsfw: boolean,
contentIsFree: boolean, contentIsFree: boolean,
price: { fee: {
amount: number, amount: number,
currency: string, currency: string,
}, },
@ -71,10 +71,13 @@ class PublishForm extends React.PureComponent<Props> {
} }
componentDidMount() { componentDidMount() {
const { thumbnail } = this.props; const { thumbnail, name, channel, editingURI } = this.props;
if (!thumbnail) { if (!thumbnail) {
this.props.resetThumbnailStatus(); this.props.resetThumbnailStatus();
} }
if (editingURI) {
this.getNewUri(name, channel);
}
} }
getNewUri(name: string, channel: string) { getNewUri(name: string, channel: string) {
@ -156,7 +159,7 @@ class PublishForm extends React.PureComponent<Props> {
let previousBidAmount = 0; let previousBidAmount = 0;
if (myClaimForUri) { if (myClaimForUri) {
previousBidAmount = myClaimForUri.amount; previousBidAmount = Number(myClaimForUri.amount);
} }
const totalAvailableBidAmount = previousBidAmount + balance; const totalAvailableBidAmount = previousBidAmount + balance;
@ -217,10 +220,11 @@ class PublishForm extends React.PureComponent<Props> {
otherLicenseDescription, otherLicenseDescription,
name: this.props.name || undefined, name: this.props.name || undefined,
contentIsFree: this.props.contentIsFree, contentIsFree: this.props.contentIsFree,
price: this.props.price, fee: this.props.fee,
uri: this.props.uri || undefined, uri: this.props.uri || undefined,
channel: this.props.channel, channel: this.props.channel,
isStillEditing: this.props.isStillEditing, isStillEditing: this.props.isStillEditing,
claim: this.props.myClaimForUri,
}; };
publish(publishParams); publish(publishParams);
@ -292,7 +296,7 @@ class PublishForm extends React.PureComponent<Props> {
language, language,
nsfw, nsfw,
contentIsFree, contentIsFree,
price, fee,
channel, channel,
name, name,
updatePublishForm, updatePublishForm,
@ -440,11 +444,11 @@ class PublishForm extends React.PureComponent<Props> {
<FormFieldPrice <FormFieldPrice
name="content_cost_amount" name="content_cost_amount"
min="0" min="0"
price={price} price={fee}
onChange={newPrice => updatePublishForm({ price: newPrice })} onChange={newFee => updatePublishForm({ fee: newFee })}
/> />
)} )}
{price.currency !== 'LBC' && ( {fee && fee.currency !== 'LBC' && (
<p className="form-field__help"> <p className="form-field__help">
{__( {__(
'All content fees are charged in LBC. For non-LBC payment methods, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase.' 'All content fees are charged in LBC. For non-LBC payment methods, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase.'

View file

@ -1,6 +1,11 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doDeleteFileAndMaybeGoBack } from 'redux/actions/file'; import { doDeleteFileAndMaybeGoBack } from 'redux/actions/file';
import { makeSelectTitleForUri, makeSelectClaimIsMine, makeSelectFileInfoForUri } from 'lbry-redux'; import {
makeSelectTitleForUri,
makeSelectClaimIsMine,
makeSelectFileInfoForUri,
makeSelectClaimForUri,
} from 'lbry-redux';
import { doHideModal } from 'redux/actions/app'; import { doHideModal } from 'redux/actions/app';
import ModalRemoveFile from './view'; import ModalRemoveFile from './view';
@ -8,6 +13,7 @@ const select = (state, props) => ({
claimIsMine: makeSelectClaimIsMine(props.uri)(state), claimIsMine: makeSelectClaimIsMine(props.uri)(state),
title: makeSelectTitleForUri(props.uri)(state), title: makeSelectTitleForUri(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state), fileInfo: makeSelectFileInfoForUri(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({

View file

@ -4,6 +4,7 @@ import { Modal } from 'modal/modal';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
type Props = { type Props = {
claim: StreamClaim,
claimIsMine: boolean, claimIsMine: boolean,
closeModal: () => void, closeModal: () => void,
deleteFile: (string, boolean, boolean) => void, deleteFile: (string, boolean, boolean) => void,
@ -45,10 +46,11 @@ class ModalRemoveFile extends React.PureComponent<Props, State> {
} }
render() { render() {
const { claimIsMine, closeModal, deleteFile, fileInfo, title } = this.props; const { claim, claimIsMine, closeModal, deleteFile, fileInfo, title } = this.props;
const { deleteChecked, abandonClaimChecked } = this.state; const { deleteChecked, abandonClaimChecked } = this.state;
const { txid, nout } = claim;
const outpoint = fileInfo ? fileInfo.outpoint : `${txid}:${nout}`;
const outpoint = fileInfo ? fileInfo.outpoint : '';
return ( return (
<Modal <Modal
isOpen isOpen

View file

@ -2,7 +2,7 @@ import * as ACTIONS from 'constants/action_types';
// @if TARGET='app' // @if TARGET='app'
import { shell } from 'electron'; import { shell } from 'electron';
// @endif // @endif
import { Lbry, batchActions, doAbandonClaim, selectMyClaimsOutpoints, selectFileInfosByOutpoint } from 'lbry-redux'; import { Lbry, batchActions, doAbandonClaim, selectMyClaimsOutpoints } from 'lbry-redux';
import { doHideModal } from 'redux/actions/app'; import { doHideModal } from 'redux/actions/app';
import { goBack } from 'connected-react-router'; import { goBack } from 'connected-react-router';
@ -33,15 +33,9 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
// If the file is for a claim we published then also abandon the claim // If the file is for a claim we published then also abandon the claim
const myClaimsOutpoints = selectMyClaimsOutpoints(state); const myClaimsOutpoints = selectMyClaimsOutpoints(state);
if (abandonClaim && myClaimsOutpoints.indexOf(outpoint) !== -1) { if (abandonClaim && myClaimsOutpoints.indexOf(outpoint) !== -1) {
const byOutpoint = selectFileInfosByOutpoint(state); const [txid, nout] = outpoint.split(':');
const fileInfo = byOutpoint[outpoint];
if (fileInfo) { dispatch(doAbandonClaim(txid, nout));
const txid = fileInfo.outpoint.slice(0, -2);
const nout = Number(fileInfo.outpoint.slice(-1));
dispatch(doAbandonClaim(txid, nout));
}
} }
dispatch({ dispatch({

View file

@ -11,6 +11,7 @@ import {
selectPendingById, selectPendingById,
selectMyClaimsWithoutChannels, selectMyClaimsWithoutChannels,
doError, doError,
isClaimNsfw,
} from 'lbry-redux'; } from 'lbry-redux';
import { doOpenModal } from 'redux/actions/app'; import { doOpenModal } from 'redux/actions/app';
import { selectosNotificationsEnabled } from 'redux/selectors/settings'; import { selectosNotificationsEnabled } from 'redux/selectors/settings';
@ -152,14 +153,14 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string) => (dispatch: Dis
contentIsFree: !fee.amount, contentIsFree: !fee.amount,
author, author,
description, description,
fee, fee: { amount: fee.amount, currency: fee.currency },
languages, languages,
thumbnail: thumbnail ? thumbnail.url : null, thumbnail: thumbnail ? thumbnail.url : null,
title, title,
uri, uri,
uploadThumbnailStatus: thumbnail ? THUMBNAIL_STATUSES.MANUAL : undefined, uploadThumbnailStatus: thumbnail ? THUMBNAIL_STATUSES.MANUAL : undefined,
licenseUrl, licenseUrl,
replace: true, nsfw: isClaimNsfw(claim),
}; };
// Make sure custom liscence's are mapped properly // Make sure custom liscence's are mapped properly
@ -203,6 +204,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
fee, fee,
uri, uri,
nsfw, nsfw,
claim,
} = params; } = params;
// get the claim id from the channel name, we will use that instead // get the claim id from the channel name, we will use that instead
@ -214,36 +216,58 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
channel_id?: string, channel_id?: string,
bid: number, bid: number,
file_path?: string, file_path?: string,
fee?: { amount: string, currency: string },
tags: Array<string>, tags: Array<string>,
locations?: Array<Location>,
license_url?: string,
thumbnail_url?: string,
release_time?: number,
fee_currency?: string,
fee_amount?: string,
} = { } = {
name, name,
bid: creditsToString(bid), bid: creditsToString(bid),
title, title,
license, license,
license_url: licenseUrl,
languages: [language], languages: [language],
description, description,
thumbnail_url: thumbnail, tags: (claim && claim.value.tags) || [],
tags: [], locations: claim && claim.value.locations,
}; };
// Temporary solution to keep the same publish flow with the new tags api // Temporary solution to keep the same publish flow with the new tags api
// Eventually we will allow users to enter their own tags on publish // Eventually we will allow users to enter their own tags on publish
// `nsfw` will probably be removed // `nsfw` will probably be removed
if (licenseUrl) {
publishPayload.license_url = licenseUrl;
}
if (thumbnail) {
publishPayload.thumbnail_url = thumbnail;
}
if (claim && claim.value.release_time) {
publishPayload.release_time = Number(claim.value.release_time);
}
if (nsfw) { if (nsfw) {
publishPayload.tags.push('mature'); if (!publishPayload.tags.includes('mature')) {
publishPayload.tags.push('mature');
}
} else {
const indexToRemove = publishPayload.tags.indexOf('mature');
if (indexToRemove > -1) {
publishPayload.tags.splice(indexToRemove, 1);
}
} }
if (channelId) { if (channelId) {
publishPayload.channel_id = channelId; publishPayload.channel_id = channelId;
} }
if (fee) { if (!contentIsFree && fee && (fee.currency && Number(fee.amount) > 0)) {
publishPayload.fee = { publishPayload.fee_currency = fee.currency;
currency: fee.currency, publishPayload.fee_amount = creditsToString(fee.amount);
amount: creditsToString(fee.amount),
};
} }
// Only pass file on new uploads, not metadata only edits. // Only pass file on new uploads, not metadata only edits.

View file

@ -9,7 +9,7 @@ type PublishState = {
editingURI: ?string, editingURI: ?string,
filePath: ?string, filePath: ?string,
contentIsFree: boolean, contentIsFree: boolean,
price: { fee: {
amount: number, amount: number,
currency: string, currency: string,
}, },
@ -33,7 +33,7 @@ const defaultState: PublishState = {
editingURI: undefined, editingURI: undefined,
filePath: undefined, filePath: undefined,
contentIsFree: true, contentIsFree: true,
price: { fee: {
amount: 1, amount: 1,
currency: 'LBC', currency: 'LBC',
}, },

View file

@ -6498,9 +6498,9 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
yargs "^13.2.2" yargs "^13.2.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#32916b04e4888c06a9bb2b07c57ce6821a4acf1a: lbry-redux@lbryio/lbry-redux#423123f1c19e61cead67c745d0892a2e4481cb6a:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/32916b04e4888c06a9bb2b07c57ce6821a4acf1a" resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/423123f1c19e61cead67c745d0892a2e4481cb6a"
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"
@ -6696,7 +6696,7 @@ lodash-es@^4.17.11, lodash-es@^4.17.4, lodash-es@^4.2.1:
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0"
integrity sha512-DHb1ub+rMjjrxqlB3H56/6MXtm1lSksDp2rA2cNWjG8mlDUYFhUj3Di2Zn5IwSU87xLv8tNIQ7sSwE/YOX/D/Q== integrity sha512-DHb1ub+rMjjrxqlB3H56/6MXtm1lSksDp2rA2cNWjG8mlDUYFhUj3Di2Zn5IwSU87xLv8tNIQ7sSwE/YOX/D/Q==
lodash.assign@^4.0.3, lodash.assign@^4.0.6, lodash.assign@^4.2.0: lodash.assign@^4.0.3, lodash.assign@^4.0.6:
version "4.2.0" version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc= integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=
@ -6706,11 +6706,6 @@ lodash.camelcase@^4.3.0:
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY=
lodash.clonedeep@^4.3.2:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=
lodash.findkey@^4.6.0: lodash.findkey@^4.6.0:
version "4.6.0" version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.findkey/-/lodash.findkey-4.6.0.tgz#83058e903b51cbb759d09ccf546dea3ea39c4718" resolved "https://registry.yarnpkg.com/lodash.findkey/-/lodash.findkey-4.6.0.tgz#83058e903b51cbb759d09ccf546dea3ea39c4718"
@ -6746,11 +6741,6 @@ lodash.memoize@^4.1.2:
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=
lodash.mergewith@^4.6.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"
integrity sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==
lodash.pickby@^4.6.0: lodash.pickby@^4.6.0:
version "4.6.0" version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff"
@ -7375,7 +7365,7 @@ nan@2.12.1:
resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552" resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552"
integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw== integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==
nan@^2.10.0, nan@^2.9.2: nan@^2.13.2, nan@^2.9.2:
version "2.13.2" version "2.13.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7" resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7"
integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw== integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==
@ -7556,9 +7546,9 @@ node-releases@^1.1.13:
semver "^5.3.0" semver "^5.3.0"
node-sass@^4.11.0: node-sass@^4.11.0:
version "4.11.0" version "4.12.0"
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.11.0.tgz#183faec398e9cbe93ba43362e2768ca988a6369a" resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.12.0.tgz#0914f531932380114a30cc5fa4fa63233a25f017"
integrity sha512-bHUdHTphgQJZaF1LASx0kAviPH7sGlcyNhWade4eVIpFp6tsn7SV8xNMTbsQFpEV9VXpnwTTnNYlfsZXgGgmkA== integrity sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ==
dependencies: dependencies:
async-foreach "^0.1.3" async-foreach "^0.1.3"
chalk "^1.1.1" chalk "^1.1.1"
@ -7567,12 +7557,10 @@ node-sass@^4.11.0:
get-stdin "^4.0.1" get-stdin "^4.0.1"
glob "^7.0.3" glob "^7.0.3"
in-publish "^2.0.0" in-publish "^2.0.0"
lodash.assign "^4.2.0" lodash "^4.17.11"
lodash.clonedeep "^4.3.2"
lodash.mergewith "^4.6.0"
meow "^3.7.0" meow "^3.7.0"
mkdirp "^0.5.1" mkdirp "^0.5.1"
nan "^2.10.0" nan "^2.13.2"
node-gyp "^3.8.0" node-gyp "^3.8.0"
npmlog "^4.0.0" npmlog "^4.0.0"
request "^2.88.0" request "^2.88.0"