From 3863c517fd10644b5aa8a7c1e5e667eb07795622 Mon Sep 17 00:00:00 2001 From: Liam Cardenas Date: Tue, 20 Feb 2018 21:41:30 -0800 Subject: [PATCH 01/14] Upgrade daemon to 0.19.0rc35 --- package.json | 2 +- src/renderer/constants/action_types.js | 4 ++-- src/renderer/lbry.js | 8 ++++---- src/renderer/redux/actions/content.js | 6 +++--- src/renderer/redux/actions/wallet.js | 2 +- src/renderer/redux/reducers/claims.js | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 8b82a3891..6f3ee8702 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ }, "license": "MIT", "lbrySettings": { - "lbrynetDaemonVersion": "0.18.2", + "lbrynetDaemonVersion": "0.19.0rc35", "lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip" } } diff --git a/src/renderer/constants/action_types.js b/src/renderer/constants/action_types.js index df8cf1407..0bd5cae80 100644 --- a/src/renderer/constants/action_types.js +++ b/src/renderer/constants/action_types.js @@ -62,8 +62,8 @@ export const FETCH_CLAIM_LIST_MINE_STARTED = 'FETCH_CLAIM_LIST_MINE_STARTED'; export const FETCH_CLAIM_LIST_MINE_COMPLETED = 'FETCH_CLAIM_LIST_MINE_COMPLETED'; export const ABANDON_CLAIM_STARTED = 'ABANDON_CLAIM_STARTED'; export const ABANDON_CLAIM_SUCCEEDED = 'ABANDON_CLAIM_SUCCEEDED'; -export const FETCH_CHANNEL_LIST_MINE_STARTED = 'FETCH_CHANNEL_LIST_MINE_STARTED'; -export const FETCH_CHANNEL_LIST_MINE_COMPLETED = 'FETCH_CHANNEL_LIST_MINE_COMPLETED'; +export const FETCH_CHANNEL_LIST_STARTED = 'FETCH_CHANNEL_LIST_STARTED'; +export const FETCH_CHANNEL_LIST_COMPLETED = 'FETCH_CHANNEL_LIST_COMPLETED'; export const CREATE_CHANNEL_STARTED = 'CREATE_CHANNEL_STARTED'; export const CREATE_CHANNEL_COMPLETED = 'CREATE_CHANNEL_COMPLETED'; export const PUBLISH_STARTED = 'PUBLISH_STARTED'; diff --git a/src/renderer/lbry.js b/src/renderer/lbry.js index 64ad8517e..130403458 100644 --- a/src/renderer/lbry.js +++ b/src/renderer/lbry.js @@ -211,11 +211,11 @@ Lbry.getAppVersionInfo = () => /** * Returns results from the file_list API method, plus dummy entries for pending publishes. - * (If a real publish with the same name is found, the pending publish will be ignored and removed.) + * (If a real publish with the same claim name is found, the pending publish will be ignored and removed.) */ Lbry.file_list = (params = {}) => new Promise((resolve, reject) => { - const { name, channel_name: channelName, outpoint } = params; + const { claim_name, channel_name: channelName, outpoint } = params; /** * If we're searching by outpoint, check first to see if there's a matching pending publish. @@ -234,10 +234,10 @@ Lbry.file_list = (params = {}) => 'file_list', params, fileInfos => { - removePendingPublishIfNeeded({ name, channelName, outpoint }); + removePendingPublishIfNeeded({ claim_name, channelName, outpoint }); // if a naked file_list call, append the pending file infos - if (!name && !channelName && !outpoint) { + if (!claim_name && !channelName && !outpoint) { const dummyFileInfos = Lbry.getPendingPublishes().map(pendingPublishToDummyFileInfo); resolve([...fileInfos, ...dummyFileInfos]); diff --git a/src/renderer/redux/actions/content.js b/src/renderer/redux/actions/content.js index 2ca2c4dbb..e0609672e 100644 --- a/src/renderer/redux/actions/content.js +++ b/src/renderer/redux/actions/content.js @@ -419,17 +419,17 @@ export function doPlayUri(uri) { export function doFetchChannelListMine() { return dispatch => { dispatch({ - type: ACTIONS.FETCH_CHANNEL_LIST_MINE_STARTED, + type: ACTIONS.FETCH_CHANNEL_LIST_STARTED, }); const callback = channels => { dispatch({ - type: ACTIONS.FETCH_CHANNEL_LIST_MINE_COMPLETED, + type: ACTIONS.FETCH_CHANNEL_LIST_COMPLETED, data: { claims: channels }, }); }; - Lbry.channel_list_mine().then(callback); + Lbry.channel_list().then(callback); }; } diff --git a/src/renderer/redux/actions/wallet.js b/src/renderer/redux/actions/wallet.js index df2faeb8d..6422b6315 100644 --- a/src/renderer/redux/actions/wallet.js +++ b/src/renderer/redux/actions/wallet.js @@ -35,7 +35,7 @@ export function doFetchTransactions() { type: ACTIONS.FETCH_TRANSACTIONS_STARTED, }); - Lbry.transaction_list({ include_tip_info: true }).then(results => { + Lbry.transaction_list().then(results => { dispatch({ type: ACTIONS.FETCH_TRANSACTIONS_COMPLETED, data: { diff --git a/src/renderer/redux/reducers/claims.js b/src/renderer/redux/reducers/claims.js index 73eee7815..5078bfccc 100644 --- a/src/renderer/redux/reducers/claims.js +++ b/src/renderer/redux/reducers/claims.js @@ -71,10 +71,10 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state, action) => { }); }; -reducers[ACTIONS.FETCH_CHANNEL_LIST_MINE_STARTED] = state => +reducers[ACTIONS.FETCH_CHANNEL_LIST_STARTED] = state => Object.assign({}, state, { fetchingMyChannels: true }); -reducers[ACTIONS.FETCH_CHANNEL_LIST_MINE_COMPLETED] = (state, action) => { +reducers[ACTIONS.FETCH_CHANNEL_LIST_COMPLETED] = (state, action) => { const { claims } = action.data; const myChannelClaims = new Set(state.myChannelClaims); const byId = Object.assign({}, state.byId); From 4aee6d5f56d243741c6167a0aa9e52c12a03fbc2 Mon Sep 17 00:00:00 2001 From: Liam Cardenas Date: Wed, 21 Feb 2018 11:01:43 -0800 Subject: [PATCH 02/14] Fix downloads page --- src/renderer/component/fileList/view.jsx | 10 +++--- src/renderer/lbryURI.js | 42 ++++++++++++------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 8dcccadc3..51670e0f5 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -20,10 +20,10 @@ class FileList extends React.PureComponent { return fileInfos.slice().sort((fileInfo1, fileInfo2) => { const title1 = fileInfo1.value ? fileInfo1.value.stream.metadata.title.toLowerCase() - : fileInfo1.name; + : fileInfo1.claim_name; const title2 = fileInfo2.value ? fileInfo2.value.stream.metadata.title.toLowerCase() - : fileInfo2.name; + : fileInfo2.claim_name; if (title1 < title2) { return -1; } else if (title1 > title2) { @@ -51,7 +51,7 @@ class FileList extends React.PureComponent { if (fileInfo.value) { return fileInfo.value.publisherSignature.certificateId; } - return fileInfo.metadata.publisherSignature.certificateId; + return fileInfo.channel_claim_id; } handleSortChanged(event) { @@ -70,11 +70,11 @@ class FileList extends React.PureComponent { if (fileInfo.channel_name) { uriParams.channelName = fileInfo.channel_name; - uriParams.contentName = fileInfo.name; + uriParams.contentName = fileInfo.claim_name; uriParams.claimId = this.getChannelSignature(fileInfo); } else { uriParams.claimId = fileInfo.claim_id; - uriParams.name = fileInfo.name; + uriParams.claim_name = fileInfo.claim_name; } const uri = buildURI(uriParams); diff --git a/src/renderer/lbryURI.js b/src/renderer/lbryURI.js index e0691965e..b611e4707 100644 --- a/src/renderer/lbryURI.js +++ b/src/renderer/lbryURI.js @@ -30,11 +30,11 @@ export function parseURI(URI, requireProto = false) { // Break into components. Empty sub-matches are converted to null const componentsRegex = new RegExp( '^((?:lbry://)?)' + // protocol - '([^:$#/]*)' + // name (stops at the first separator or end) + '([^:$#/]*)' + // claim name (stops at the first separator or end) '([:$#]?)([^/]*)' + // modifier separator, modifier (stops at the first path separator or end) '(/?)(.*)' // path separator, path ); - const [proto, name, modSep, modVal, pathSep, path] = componentsRegex + const [proto, claim_name, modSep, modVal, pathSep, path] = componentsRegex .exec(URI) .slice(1) .map(match => match || null); @@ -47,12 +47,12 @@ export function parseURI(URI, requireProto = false) { } // Validate and process name - if (!name) { + if (!claim_name) { throw new Error(__('URI does not include name.')); } - const isChannel = name.startsWith('@'); - const channelName = isChannel ? name.slice(1) : name; + const isChannel = claim_name.startsWith('@'); + const channelName = isChannel ? claim_name.slice(1) : claim_name; if (isChannel) { if (!channelName) { @@ -66,7 +66,7 @@ export function parseURI(URI, requireProto = false) { contentName = path; } - const nameBadChars = (channelName || name).match(regexInvalidURI); + const nameBadChars = (channelName || claim_name).match(regexInvalidURI); if (nameBadChars) { throw new Error( __( @@ -128,7 +128,7 @@ export function parseURI(URI, requireProto = false) { } return { - name, + claim_name, path, isChannel, ...(contentName ? { contentName } : {}), @@ -148,24 +148,24 @@ export function parseURI(URI, requireProto = false) { export function buildURI(URIObj, includeProto = true) { const { claimId, claimSequence, bidPosition, contentName, channelName } = URIObj; - let { name, path } = URIObj; + let { claim_name, path } = URIObj; if (channelName) { const channelNameFormatted = channelName.startsWith('@') ? channelName : `@${channelName}`; - if (!name) { - name = channelNameFormatted; - } else if (name !== channelNameFormatted) { + if (!claim_name) { + claim_name = channelNameFormatted; + } else if (claim_name !== channelNameFormatted) { throw new Error( __( - 'Received a channel content URI, but name and channelName do not match. "name" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.' + 'Received a channel content URI, but claim name and channelName do not match. "name" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.' ) ); } } if (contentName) { - if (!name) { - name = contentName; + if (!claim_name) { + claim_name = contentName; } else if (!path) { path = contentName; } @@ -180,7 +180,7 @@ export function buildURI(URIObj, includeProto = true) { return ( (includeProto ? 'lbry://' : '') + - name + + claim_name + (claimId ? `#${claimId}` : '') + (claimSequence ? `:${claimSequence}` : '') + (bidPosition ? `${bidPosition}` : '') + @@ -192,8 +192,8 @@ export function buildURI(URIObj, includeProto = true) { export function normalizeURI(URI) { if (URI.match(/pending_claim/)) return URI; - const { name, path, bidPosition, claimSequence, claimId } = parseURI(URI); - return buildURI({ name, path, claimSequence, bidPosition, claimId }); + const { claim_name, path, bidPosition, claimSequence, claimId } = parseURI(URI); + return buildURI({ claim_name, path, claimSequence, bidPosition, claimId }); } export function isURIValid(URI) { @@ -203,12 +203,12 @@ export function isURIValid(URI) { } catch (error) { return false; } - return parts && parts.name; + return parts && parts.claim_name; } -export function isNameValid(name, checkCase = true) { +export function isNameValid(claim_name, checkCase = true) { const regexp = new RegExp('^[a-z0-9-]+$', checkCase ? '' : 'i'); - return regexp.test(name); + return regexp.test(claim_name); } export function isURIClaimable(URI) { @@ -220,7 +220,7 @@ export function isURIClaimable(URI) { } return ( parts && - parts.name && + parts.claim_name && !parts.claimId && !parts.bidPosition && !parts.claimSequence && From 26c62fc326c359cf11e8dc116608f751ad9a991a Mon Sep 17 00:00:00 2001 From: Liam Cardenas Date: Wed, 21 Feb 2018 11:10:36 -0800 Subject: [PATCH 03/14] Update claim_name to cammel case in lbryuri --- src/renderer/component/fileList/view.jsx | 2 +- src/renderer/lbryURI.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 51670e0f5..4b737189c 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -74,7 +74,7 @@ class FileList extends React.PureComponent { uriParams.claimId = this.getChannelSignature(fileInfo); } else { uriParams.claimId = fileInfo.claim_id; - uriParams.claim_name = fileInfo.claim_name; + uriParams.claimName = fileInfo.claim_name; } const uri = buildURI(uriParams); diff --git a/src/renderer/lbryURI.js b/src/renderer/lbryURI.js index b611e4707..ba0aff2ec 100644 --- a/src/renderer/lbryURI.js +++ b/src/renderer/lbryURI.js @@ -34,7 +34,7 @@ export function parseURI(URI, requireProto = false) { '([:$#]?)([^/]*)' + // modifier separator, modifier (stops at the first path separator or end) '(/?)(.*)' // path separator, path ); - const [proto, claim_name, modSep, modVal, pathSep, path] = componentsRegex + const [proto, claimName, modSep, modVal, pathSep, path] = componentsRegex .exec(URI) .slice(1) .map(match => match || null); @@ -47,12 +47,12 @@ export function parseURI(URI, requireProto = false) { } // Validate and process name - if (!claim_name) { + if (!claimName) { throw new Error(__('URI does not include name.')); } - const isChannel = claim_name.startsWith('@'); - const channelName = isChannel ? claim_name.slice(1) : claim_name; + const isChannel = claimName.startsWith('@'); + const channelName = isChannel ? claimName.slice(1) : claimName; if (isChannel) { if (!channelName) { @@ -66,7 +66,7 @@ export function parseURI(URI, requireProto = false) { contentName = path; } - const nameBadChars = (channelName || claim_name).match(regexInvalidURI); + const nameBadChars = (channelName || claimName).match(regexInvalidURI); if (nameBadChars) { throw new Error( __( @@ -128,7 +128,7 @@ export function parseURI(URI, requireProto = false) { } return { - claim_name, + claim_name: claimName, path, isChannel, ...(contentName ? { contentName } : {}), From dcd5a7e28dedcd85a704bb780ada7d48146e26a1 Mon Sep 17 00:00:00 2001 From: Liam Cardenas Date: Thu, 22 Feb 2018 12:00:04 -0800 Subject: [PATCH 04/14] RC35 -> RC37 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6f3ee8702..415fcc184 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ }, "license": "MIT", "lbrySettings": { - "lbrynetDaemonVersion": "0.19.0rc35", + "lbrynetDaemonVersion": "0.19.0rc37", "lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip" } } From 371a254867fd5d094f5e1eca1e069eaa5139d045 Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 15:59:26 -0800 Subject: [PATCH 05/14] RC37 --> 0.19.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 869f38c03..c1dcd0b99 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ }, "license": "MIT", "lbrySettings": { - "lbrynetDaemonVersion": "0.19.0rc37", + "lbrynetDaemonVersion": "0.19.0", "lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip" } } From 1cb122c839376d1fb002c1c9dd66c86e15b1a5cf Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 17:56:48 -0800 Subject: [PATCH 06/14] Fix claim name undefined in buildURI bug --- .../internal/TransactionListItem.jsx | 2 +- src/renderer/lbryURI.js | 16 ++++++++-------- src/renderer/page/channel/view.jsx | 2 +- src/renderer/redux/actions/content.js | 2 +- src/renderer/redux/actions/search.js | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/renderer/component/transactionList/internal/TransactionListItem.jsx b/src/renderer/component/transactionList/internal/TransactionListItem.jsx index 0192e33d1..20d7e4bfd 100644 --- a/src/renderer/component/transactionList/internal/TransactionListItem.jsx +++ b/src/renderer/component/transactionList/internal/TransactionListItem.jsx @@ -74,7 +74,7 @@ class TransactionListItem extends React.PureComponent { {name} diff --git a/src/renderer/lbryURI.js b/src/renderer/lbryURI.js index ba0aff2ec..66a8ee834 100644 --- a/src/renderer/lbryURI.js +++ b/src/renderer/lbryURI.js @@ -148,13 +148,13 @@ export function parseURI(URI, requireProto = false) { export function buildURI(URIObj, includeProto = true) { const { claimId, claimSequence, bidPosition, contentName, channelName } = URIObj; - let { claim_name, path } = URIObj; + let { claimName, path } = URIObj; if (channelName) { const channelNameFormatted = channelName.startsWith('@') ? channelName : `@${channelName}`; - if (!claim_name) { - claim_name = channelNameFormatted; - } else if (claim_name !== channelNameFormatted) { + if (!claimName) { + claimName = channelNameFormatted; + } else if (claimName !== channelNameFormatted) { throw new Error( __( 'Received a channel content URI, but claim name and channelName do not match. "name" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.' @@ -164,8 +164,8 @@ export function buildURI(URIObj, includeProto = true) { } if (contentName) { - if (!claim_name) { - claim_name = contentName; + if (!claimName) { + claimName = contentName; } else if (!path) { path = contentName; } @@ -180,7 +180,7 @@ export function buildURI(URIObj, includeProto = true) { return ( (includeProto ? 'lbry://' : '') + - claim_name + + claimName + (claimId ? `#${claimId}` : '') + (claimSequence ? `:${claimSequence}` : '') + (bidPosition ? `${bidPosition}` : '') + @@ -193,7 +193,7 @@ export function normalizeURI(URI) { if (URI.match(/pending_claim/)) return URI; const { claim_name, path, bidPosition, claimSequence, claimId } = parseURI(URI); - return buildURI({ claim_name, path, claimSequence, bidPosition, claimId }); + return buildURI({ claimName: claim_name, path, claimSequence, bidPosition, claimId }); } export function isURIValid(URI) { diff --git a/src/renderer/page/channel/view.jsx b/src/renderer/page/channel/view.jsx index ae1f6b332..4614bb5c7 100644 --- a/src/renderer/page/channel/view.jsx +++ b/src/renderer/page/channel/view.jsx @@ -58,7 +58,7 @@ class ChannelPage extends React.PureComponent { { const uri = buildURI({ - name: result.name, + claimName: result.name, claimId: result.claimId, }); actions.push(doResolveUri(uri)); From c199a2498669f6312c4b2e2f45c7e9d8222e08ac Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 21:27:06 -0800 Subject: [PATCH 07/14] Catch undefined reference to anonymous upload names --- src/renderer/component/fileList/view.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 31b3efc37..5a8b9d38e 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -95,7 +95,7 @@ class FileList extends React.PureComponent { uriParams.claimId = this.getChannelSignature(fileInfo); } else { uriParams.claimId = fileInfo.claim_id; - uriParams.claimName = fileInfo.claim_name; + uriParams.claimName = fileInfo.claim_name || fileInfo.name; } const uri = buildURI(uriParams); From bd785502f43c3d4116e170a586d424e223fc30fe Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 22:25:55 -0800 Subject: [PATCH 08/14] Fix sorting on downloads/published pages --- src/renderer/component/fileList/index.js | 5 ++- src/renderer/component/fileList/view.jsx | 40 +++++++++++------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/renderer/component/fileList/index.js b/src/renderer/component/fileList/index.js index 3b6ced934..bfaff712a 100644 --- a/src/renderer/component/fileList/index.js +++ b/src/renderer/component/fileList/index.js @@ -1,8 +1,11 @@ import React from 'react'; import { connect } from 'react-redux'; import FileList from './view'; +import { selectClaimsById } from 'redux/selectors/claims'; -const select = state => ({}); +const select = state => ({ + claimsById: selectClaimsById(state), +}); const perform = dispatch => ({}); diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 5a8b9d38e..5cd65992b 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -13,32 +13,30 @@ class FileList extends React.PureComponent { }; this._sortFunctions = { - dateNew(fileInfos) { - return fileInfos.slice().sort((fileInfo1, fileInfo2) => { - const height1 = fileInfo1.height; - const height2 = fileInfo2.height; + dateNew: (fileInfos) => + fileInfos.slice().sort((fileInfo1, fileInfo2) => { + const height1 = this.props.claimsById[fileInfo1.claim_id].height; + const height2 = this.props.claimsById[fileInfo2.claim_id].height; if (height1 > height2) { return -1; } else if (height1 < height2) { return 1; } return 0; - }); - }, - dateOld(fileInfos) { - return fileInfos.slice().sort((fileInfo1, fileInfo2) => { - const height1 = fileInfo1.height; - const height2 = fileInfo2.height; + }), + dateOld: (fileInfos) => + fileInfos.slice().sort((fileInfo1, fileInfo2) => { + const height1 = this.props.claimsById[fileInfo1.claim_id].height; + const height2 = this.props.claimsById[fileInfo2.claim_id].height; if (height1 < height2) { return -1; } else if (height1 > height2) { return 1; } return 0; - }); - }, - title(fileInfos) { - return fileInfos.slice().sort((fileInfo1, fileInfo2) => { + }), + title: (fileInfos) => + fileInfos.slice().sort((fileInfo1, fileInfo2) => { const title1 = fileInfo1.value ? fileInfo1.value.stream.metadata.title.toLowerCase() : fileInfo1.claim_name; @@ -51,10 +49,9 @@ class FileList extends React.PureComponent { return 1; } return 0; - }); - }, - filename(fileInfos) { - return fileInfos.slice().sort(({ file_name: fileName1 }, { file_name: fileName2 }) => { + }), + filename: (fileInfos) => + fileInfos.slice().sort(({ file_name: fileName1 }, { file_name: fileName2 }) => { const fileName1Lower = fileName1.toLowerCase(); const fileName2Lower = fileName2.toLowerCase(); if (fileName1Lower < fileName2Lower) { @@ -63,10 +60,9 @@ class FileList extends React.PureComponent { return 1; } return 0; - }); - }, - }; - } + }), + }; + } getChannelSignature(fileInfo) { if (fileInfo.value) { From abdc15989c1241cb9c57309a599614b76c46ab50 Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 22:46:03 -0800 Subject: [PATCH 09/14] Fix search --- src/renderer/component/fileListSearch/view.jsx | 2 +- src/renderer/lbryURI.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/renderer/component/fileListSearch/view.jsx b/src/renderer/component/fileListSearch/view.jsx index d29e9d967..89e99ca65 100644 --- a/src/renderer/component/fileListSearch/view.jsx +++ b/src/renderer/component/fileListSearch/view.jsx @@ -45,7 +45,7 @@ class FileListSearch extends React.PureComponent { {uris && uris.length ? uris.map( uri => - parseURI(uri).name[0] === '@' ? ( + parseURI(uri).claimName[0] === '@' ? ( ) : ( diff --git a/src/renderer/lbryURI.js b/src/renderer/lbryURI.js index 66a8ee834..9fd136b92 100644 --- a/src/renderer/lbryURI.js +++ b/src/renderer/lbryURI.js @@ -128,7 +128,7 @@ export function parseURI(URI, requireProto = false) { } return { - claim_name: claimName, + claimName, path, isChannel, ...(contentName ? { contentName } : {}), @@ -192,8 +192,8 @@ export function buildURI(URIObj, includeProto = true) { export function normalizeURI(URI) { if (URI.match(/pending_claim/)) return URI; - const { claim_name, path, bidPosition, claimSequence, claimId } = parseURI(URI); - return buildURI({ claimName: claim_name, path, claimSequence, bidPosition, claimId }); + const { claimName, path, bidPosition, claimSequence, claimId } = parseURI(URI); + return buildURI({ claimName, path, claimSequence, bidPosition, claimId }); } export function isURIValid(URI) { @@ -203,12 +203,12 @@ export function isURIValid(URI) { } catch (error) { return false; } - return parts && parts.claim_name; + return parts && parts.claimName; } -export function isNameValid(claim_name, checkCase = true) { +export function isNameValid(claimName, checkCase = true) { const regexp = new RegExp('^[a-z0-9-]+$', checkCase ? '' : 'i'); - return regexp.test(claim_name); + return regexp.test(claimName); } export function isURIClaimable(URI) { @@ -220,7 +220,7 @@ export function isURIClaimable(URI) { } return ( parts && - parts.claim_name && + parts.claimName && !parts.claimId && !parts.bidPosition && !parts.claimSequence && From 95848480775c316b9139bfed0951831d918446ec Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 23:03:30 -0800 Subject: [PATCH 10/14] Remove channels from published page --- src/renderer/component/fileList/view.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 5cd65992b..22444077b 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -87,7 +87,7 @@ class FileList extends React.PureComponent { if (fileInfo.channel_name) { uriParams.channelName = fileInfo.channel_name; - uriParams.contentName = fileInfo.claim_name; + uriParams.contentName = fileInfo.claim_name || fileInfo.name; uriParams.claimId = this.getChannelSignature(fileInfo); } else { uriParams.claimId = fileInfo.claim_id; From 0c833a727e6419fe56742c9aa119c18fc7448599 Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 23:06:15 -0800 Subject: [PATCH 11/14] Formatted whole app --- src/renderer/component/fileList/view.jsx | 12 ++++++------ src/renderer/component/userPhoneVerify/view.jsx | 4 +--- src/renderer/redux/actions/content.js | 4 +--- src/renderer/scss/component/_checkbox.scss | 2 +- src/renderer/scss/component/_table.scss | 2 +- src/renderer/scss/component/_tooltip.scss | 4 ++-- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 22444077b..800fda842 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -13,7 +13,7 @@ class FileList extends React.PureComponent { }; this._sortFunctions = { - dateNew: (fileInfos) => + dateNew: fileInfos => fileInfos.slice().sort((fileInfo1, fileInfo2) => { const height1 = this.props.claimsById[fileInfo1.claim_id].height; const height2 = this.props.claimsById[fileInfo2.claim_id].height; @@ -24,7 +24,7 @@ class FileList extends React.PureComponent { } return 0; }), - dateOld: (fileInfos) => + dateOld: fileInfos => fileInfos.slice().sort((fileInfo1, fileInfo2) => { const height1 = this.props.claimsById[fileInfo1.claim_id].height; const height2 = this.props.claimsById[fileInfo2.claim_id].height; @@ -35,7 +35,7 @@ class FileList extends React.PureComponent { } return 0; }), - title: (fileInfos) => + title: fileInfos => fileInfos.slice().sort((fileInfo1, fileInfo2) => { const title1 = fileInfo1.value ? fileInfo1.value.stream.metadata.title.toLowerCase() @@ -50,7 +50,7 @@ class FileList extends React.PureComponent { } return 0; }), - filename: (fileInfos) => + filename: fileInfos => fileInfos.slice().sort(({ file_name: fileName1 }, { file_name: fileName2 }) => { const fileName1Lower = fileName1.toLowerCase(); const fileName2Lower = fileName2.toLowerCase(); @@ -61,8 +61,8 @@ class FileList extends React.PureComponent { } return 0; }), - }; - } + }; + } getChannelSignature(fileInfo) { if (fileInfo.value) { diff --git a/src/renderer/component/userPhoneVerify/view.jsx b/src/renderer/component/userPhoneVerify/view.jsx index 2ee39c1e8..225fad5d1 100644 --- a/src/renderer/component/userPhoneVerify/view.jsx +++ b/src/renderer/component/userPhoneVerify/view.jsx @@ -33,9 +33,7 @@ class UserPhoneVerify extends React.PureComponent {

{__( - `Please enter the verification code sent to +${countryCode}${ - phone - }. Didn't receive it? ` + `Please enter the verification code sent to +${countryCode}${phone}. Didn't receive it? ` )}

diff --git a/src/renderer/redux/actions/content.js b/src/renderer/redux/actions/content.js index beece21ca..683aa3b32 100644 --- a/src/renderer/redux/actions/content.js +++ b/src/renderer/redux/actions/content.js @@ -277,9 +277,7 @@ export function doLoadVideo(uri) { }); dispatch( doAlertError( - `Failed to download ${ - uri - }, please try again. If this problem persists, visit https://lbry.io/faq/support for support.` + `Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.` ) ); }); diff --git a/src/renderer/scss/component/_checkbox.scss b/src/renderer/scss/component/_checkbox.scss index b72f7c896..d4796afe6 100644 --- a/src/renderer/scss/component/_checkbox.scss +++ b/src/renderer/scss/component/_checkbox.scss @@ -51,7 +51,7 @@ $md-checkmark-color: #fff; border: none; } + label:after { - $md-checkmark-size: $md-checkbox-size - 2*$md-checkbox-padding; + $md-checkmark-size: $md-checkbox-size - 2 * $md-checkbox-padding; transform: rotate(-45deg); diff --git a/src/renderer/scss/component/_table.scss b/src/renderer/scss/component/_table.scss index 1c6b17369..428c5d152 100644 --- a/src/renderer/scss/component/_table.scss +++ b/src/renderer/scss/component/_table.scss @@ -18,7 +18,7 @@ table.table-standard { vertical-align: bottom; font-weight: 500; font-size: 0.9em; - padding: $spacing-vertical/4+1 8px $spacing-vertical/4-2; + padding: $spacing-vertical/4 + 1 8px $spacing-vertical/4-2; text-align: left; border-bottom: var(--table-border); img { diff --git a/src/renderer/scss/component/_tooltip.scss b/src/renderer/scss/component/_tooltip.scss index d017996c1..91fbe3f2f 100644 --- a/src/renderer/scss/component/_tooltip.scss +++ b/src/renderer/scss/component/_tooltip.scss @@ -20,14 +20,14 @@ border: var(--tooltip-border); color: var(--tooltip-color); background-color: var(--tooltip-bg); - font-size: calc(var(--font-size) * 7/8); + font-size: calc(var(--font-size) * 7 / 8); line-height: var(--font-line-height); box-shadow: var(--box-shadow-layer); } .tooltip--header .tooltip__link { @include text-link(#aaa); - font-size: calc(var(--font-size) * 3/4); + font-size: calc(var(--font-size) * 3 / 4); margin-left: var(--button-padding); vertical-align: middle; } From fa91f3cea5f5e5b495fecad54723ea8b84be5502 Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 23:10:37 -0800 Subject: [PATCH 12/14] Fix abandon claim issue --- src/renderer/redux/actions/content.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/redux/actions/content.js b/src/renderer/redux/actions/content.js index 683aa3b32..d5671bba4 100644 --- a/src/renderer/redux/actions/content.js +++ b/src/renderer/redux/actions/content.js @@ -521,7 +521,7 @@ export function doAbandonClaim(txid, nout) { claimId, }, }); - dispatch(doResolveUri(buildURI({ claimName, claimId }))); + dispatch(doResolveUri(buildURI({ claimName: name, claimId }))); dispatch(doFetchClaimListMine()); } else { dispatch(doOpenModal(MODALS.TRANSACTION_FAILED)); From c8cad17f9794d22f6a66916b133d3ed1e2c76e79 Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 23:32:55 -0800 Subject: [PATCH 13/14] Fixed sort after abandoning claim --- src/renderer/component/fileList/view.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 800fda842..266f5bc58 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -15,8 +15,8 @@ class FileList extends React.PureComponent { this._sortFunctions = { dateNew: fileInfos => fileInfos.slice().sort((fileInfo1, fileInfo2) => { - const height1 = this.props.claimsById[fileInfo1.claim_id].height; - const height2 = this.props.claimsById[fileInfo2.claim_id].height; + const height1 = this.props.claimsById[fileInfo1.claim_id] ? this.props.claimsById[fileInfo1.claim_id].height : 0; + const height2 = this.props.claimsById[fileInfo2.claim_id] ? this.props.claimsById[fileInfo2.claim_id].height : 0; if (height1 > height2) { return -1; } else if (height1 < height2) { @@ -26,8 +26,8 @@ class FileList extends React.PureComponent { }), dateOld: fileInfos => fileInfos.slice().sort((fileInfo1, fileInfo2) => { - const height1 = this.props.claimsById[fileInfo1.claim_id].height; - const height2 = this.props.claimsById[fileInfo2.claim_id].height; + const height1 = this.props.claimsById[fileInfo1.claim_id] ? this.props.claimsById[fileInfo1.claim_id].height : 999999; + const height2 = this.props.claimsById[fileInfo2.claim_id] ? this.props.claimsById[fileInfo2.claim_id].height : 999999; if (height1 < height2) { return -1; } else if (height1 > height2) { From a4faab5e86ee438149a09ba529522b34ebc01802 Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Thu, 8 Mar 2018 23:46:16 -0800 Subject: [PATCH 14/14] Refactor and reformat --- src/renderer/component/fileList/view.jsx | 16 ++++++++++++---- src/renderer/lbry.js | 6 +++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 266f5bc58..686665078 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -15,8 +15,12 @@ class FileList extends React.PureComponent { this._sortFunctions = { dateNew: fileInfos => fileInfos.slice().sort((fileInfo1, fileInfo2) => { - const height1 = this.props.claimsById[fileInfo1.claim_id] ? this.props.claimsById[fileInfo1.claim_id].height : 0; - const height2 = this.props.claimsById[fileInfo2.claim_id] ? this.props.claimsById[fileInfo2.claim_id].height : 0; + const height1 = this.props.claimsById[fileInfo1.claim_id] + ? this.props.claimsById[fileInfo1.claim_id].height + : 0; + const height2 = this.props.claimsById[fileInfo2.claim_id] + ? this.props.claimsById[fileInfo2.claim_id].height + : 0; if (height1 > height2) { return -1; } else if (height1 < height2) { @@ -26,8 +30,12 @@ class FileList extends React.PureComponent { }), dateOld: fileInfos => fileInfos.slice().sort((fileInfo1, fileInfo2) => { - const height1 = this.props.claimsById[fileInfo1.claim_id] ? this.props.claimsById[fileInfo1.claim_id].height : 999999; - const height2 = this.props.claimsById[fileInfo2.claim_id] ? this.props.claimsById[fileInfo2.claim_id].height : 999999; + const height1 = this.props.claimsById[fileInfo1.claim_id] + ? this.props.claimsById[fileInfo1.claim_id].height + : 999999; + const height2 = this.props.claimsById[fileInfo2.claim_id] + ? this.props.claimsById[fileInfo2.claim_id].height + : 999999; if (height1 < height2) { return -1; } else if (height1 > height2) { diff --git a/src/renderer/lbry.js b/src/renderer/lbry.js index 130403458..79855b4ce 100644 --- a/src/renderer/lbry.js +++ b/src/renderer/lbry.js @@ -215,7 +215,7 @@ Lbry.getAppVersionInfo = () => */ Lbry.file_list = (params = {}) => new Promise((resolve, reject) => { - const { claim_name, channel_name: channelName, outpoint } = params; + const { claim_name: claimName, channel_name: channelName, outpoint } = params; /** * If we're searching by outpoint, check first to see if there's a matching pending publish. @@ -234,10 +234,10 @@ Lbry.file_list = (params = {}) => 'file_list', params, fileInfos => { - removePendingPublishIfNeeded({ claim_name, channelName, outpoint }); + removePendingPublishIfNeeded({ name: claimName, channelName, outpoint }); // if a naked file_list call, append the pending file infos - if (!claim_name && !channelName && !outpoint) { + if (!claimName && !channelName && !outpoint) { const dummyFileInfos = Lbry.getPendingPublishes().map(pendingPublishToDummyFileInfo); resolve([...fileInfos, ...dummyFileInfos]);