more pending and publishing fixes

This commit is contained in:
Jeremy Kauffman 2017-06-28 18:08:16 -04:00
parent 8d62b4d1fc
commit b815f78a50
3 changed files with 15 additions and 9 deletions

View file

@ -67,11 +67,15 @@ class FileList extends React.PureComponent {
const content = []; const content = [];
this._sortFunctions[sortBy](fileInfos).forEach(fileInfo => { this._sortFunctions[sortBy](fileInfos).forEach(fileInfo => {
const uri = lbryuri.build({ let uriParams = {};
contentName: fileInfo.name, if (fileInfo.channel_name) {
channelName: fileInfo.channel_name, uriParams.channelName = fileInfo.channel_name;
claimId: fileInfo.claim_id, uriParams.contentName = fileInfo.name;
}); } else {
uriParams.claimId = fileInfo.claim_id;
uriParams.name = fileInfo.name;
}
const uri = lbryuri.build(uriParams);
content.push( content.push(
<FileTile <FileTile

View file

@ -37,6 +37,7 @@ function apiCall(method, params, resolve, reject) {
* Records a publish attempt in local storage. Returns a dictionary with all the data needed to * Records a publish attempt in local storage. Returns a dictionary with all the data needed to
* needed to make a dummy claim or file info object. * needed to make a dummy claim or file info object.
*/ */
let pendingId = 0;
function savePendingPublish({ name, channel_name }) { function savePendingPublish({ name, channel_name }) {
let uri; let uri;
if (channel_name) { if (channel_name) {
@ -44,14 +45,15 @@ function savePendingPublish({ name, channel_name }) {
} else { } else {
uri = lbryuri.build({ name: name }, false); uri = lbryuri.build({ name: name }, false);
} }
++pendingId;
const pendingPublishes = getLocal("pendingPublishes") || []; const pendingPublishes = getLocal("pendingPublishes") || [];
const newPendingPublish = { const newPendingPublish = {
name, name,
channel_name, channel_name,
claim_id: "pending-" + uri, claim_id: "pending-" + pendingId,
txid: "pending_" + uri, txid: "pending-" + pendingId,
nout: 0, nout: 0,
outpoint: "pending-" + uri + ":0", outpoint: "pending-" + pendingId + ":0",
time: Date.now(), time: Date.now(),
}; };
setLocal("pendingPublishes", [...pendingPublishes, newPendingPublish]); setLocal("pendingPublishes", [...pendingPublishes, newPendingPublish]);

View file

@ -122,7 +122,7 @@ lbryuri.parse = function(uri, requireProto = false) {
const pathBadChars = path.match(/[^A-Za-z0-9-]/g); const pathBadChars = path.match(/[^A-Za-z0-9-]/g);
if (pathBadChars) { if (pathBadChars) {
throw new Error( throw new Error(
__(`Invalid character in path: %s`, nameBadChars.join(", ")) __(`Invalid character in path: %s`, pathBadChars.join(", "))
); );
} }