- {__("Email")}{" "} + {__("Check your email for a verification code. Email")}{" "} {" "} {__("if you did not receive or are having trouble with your code.")}
diff --git a/ui/js/lbry.js b/ui/js/lbry.js index 6b4730762..07dec7e5e 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -291,7 +291,7 @@ lbry.setClientSetting = function(setting, value) { lbry.formatName = function(name) { // Converts LBRY name to standard format (all lower case, no special characters, spaces replaced by dashes) name = name.replace("/s+/g", "-"); - name = name.toLowerCase().replace(/[^a-z0-9\-]/g, ""); + name = name.toLowerCase().replace(lbryuri.REGEXP_INVALID_URI, ""); return name; }; diff --git a/ui/js/lbryuri.js b/ui/js/lbryuri.js index 42a825949..a7f43890a 100644 --- a/ui/js/lbryuri.js +++ b/ui/js/lbryuri.js @@ -3,6 +3,8 @@ const CLAIM_ID_MAX_LEN = 40; const lbryuri = {}; +lbryuri.REGEXP_INVALID_URI = /[^A-Za-z0-9-]/g; + /** * Parses a LBRY name into its component parts. Throws errors with user-friendly * messages for invalid names. @@ -70,7 +72,7 @@ lbryuri.parse = function(uri, requireProto = false) { contentName = path; } - const nameBadChars = (channelName || name).match(/[^A-Za-z0-9-]/g); + const nameBadChars = (channelName || name).match(lbryuri.REGEXP_INVALID_URI); if (nameBadChars) { throw new Error( __( @@ -119,7 +121,7 @@ lbryuri.parse = function(uri, requireProto = false) { throw new Error(__("Only channel URIs may have a path.")); } - const pathBadChars = path.match(/[^A-Za-z0-9-]/g); + const pathBadChars = path.match(lbryuri.REGEXP_INVALID_URI); if (pathBadChars) { throw new Error( __(`Invalid character in path: %s`, pathBadChars.join(", ")) diff --git a/ui/js/reducers/file_info.js b/ui/js/reducers/file_info.js index 500fbdf82..cb5221c98 100644 --- a/ui/js/reducers/file_info.js +++ b/ui/js/reducers/file_info.js @@ -58,15 +58,15 @@ reducers[types.DOWNLOADING_STARTED] = function(state, action) { const { uri, outpoint, fileInfo } = action.data; const newByOutpoint = Object.assign({}, state.byOutpoint); - const newDownloading = Object.assign({}, state.urisDownloading); + const newDownloading = Object.assign({}, state.downloadingByOutpoin); const newLoading = Object.assign({}, state.urisLoading); - newDownloading[uri] = true; + newDownloading[outpoint] = true; newByOutpoint[outpoint] = fileInfo; delete newLoading[uri]; return Object.assign({}, state, { - urisDownloading: newDownloading, + downloadingByOutpoint: newDownloading, urisLoading: newLoading, byOutpoint: newByOutpoint, }); @@ -76,14 +76,14 @@ reducers[types.DOWNLOADING_PROGRESSED] = function(state, action) { const { uri, outpoint, fileInfo } = action.data; const newByOutpoint = Object.assign({}, state.byOutpoint); - const newDownloading = Object.assign({}, state.urisDownloading); + const newDownloading = Object.assign({}, state.downloadingByOutpoint); newByOutpoint[outpoint] = fileInfo; - newDownloading[uri] = true; + newDownloading[outpoint] = true; return Object.assign({}, state, { byOutpoint: newByOutpoint, - urisDownloading: newDownloading, + downloadingByOutpoint: newDownloading, }); }; @@ -91,14 +91,14 @@ reducers[types.DOWNLOADING_COMPLETED] = function(state, action) { const { uri, outpoint, fileInfo } = action.data; const newByOutpoint = Object.assign({}, state.byOutpoint); - const newDownloading = Object.assign({}, state.urisDownloading); + const newDownloading = Object.assign({}, state.downloadingByOutpoint); newByOutpoint[outpoint] = fileInfo; - delete newDownloading[uri]; + delete newDownloading[outpoint]; return Object.assign({}, state, { byOutpoint: newByOutpoint, - urisDownloading: newDownloading, + downloadingByOutpoint: newDownloading, }); }; @@ -106,11 +106,14 @@ reducers[types.FILE_DELETE] = function(state, action) { const { outpoint } = action.data; const newByOutpoint = Object.assign({}, state.byOutpoint); + const downloadingByOutpoint = Object.assign({}, state.downloadingByOutpoint); delete newByOutpoint[outpoint]; + delete downloadingByOutpoint[outpoint]; return Object.assign({}, state, { byOutpoint: newByOutpoint, + downloadingByOutpoint, }); }; diff --git a/ui/js/selectors/file_info.js b/ui/js/selectors/file_info.js index ef469ab02..1b3dc7982 100644 --- a/ui/js/selectors/file_info.js +++ b/ui/js/selectors/file_info.js @@ -39,14 +39,18 @@ export const makeSelectFileInfoForUri = () => { return createSelector(selectFileInfoForUri, fileInfo => fileInfo); }; -export const selectUrisDownloading = createSelector( +export const selectDownloadingByOutpoint = createSelector( _selectState, - state => state.urisDownloading || {} + state => state.downloadingByOutpoint || {} ); const selectDownloadingForUri = (state, props) => { - const byUri = selectUrisDownloading(state); - return byUri[props.uri]; + const byOutpoint = selectDownloadingByOutpoint(state); + const fileInfo = selectFileInfoForUri(state, props); + + if (!fileInfo) return false; + + return byOutpoint[fileInfo.outpoint]; }; export const makeSelectDownloadingForUri = () => { @@ -135,14 +139,14 @@ export const selectFileInfosByUri = createSelector( ); export const selectDownloadingFileInfos = createSelector( - selectUrisDownloading, - selectFileInfosByUri, - (urisDownloading, byUri) => { - const uris = Object.keys(urisDownloading); + selectDownloadingByOutpoint, + selectFileInfosByOutpoint, + (downloadingByOutpoint, fileInfosByOutpoint) => { + const outpoints = Object.keys(downloadingByOutpoint); const fileInfos = []; - uris.forEach(uri => { - const fileInfo = byUri[uri]; + outpoints.forEach(outpoint => { + const fileInfo = fileInfosByOutpoint[outpoint]; if (fileInfo) fileInfos.push(fileInfo); });