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 = [];
this._sortFunctions[sortBy](fileInfos).forEach(fileInfo => {
const uri = lbryuri.build({
contentName: fileInfo.name,
channelName: fileInfo.channel_name,
claimId: fileInfo.claim_id,
});
let uriParams = {};
if (fileInfo.channel_name) {
uriParams.channelName = fileInfo.channel_name;
uriParams.contentName = fileInfo.name;
} else {
uriParams.claimId = fileInfo.claim_id;
uriParams.name = fileInfo.name;
}
const uri = lbryuri.build(uriParams);
content.push(
<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
* needed to make a dummy claim or file info object.
*/
let pendingId = 0;
function savePendingPublish({ name, channel_name }) {
let uri;
if (channel_name) {
@ -44,14 +45,15 @@ function savePendingPublish({ name, channel_name }) {
} else {
uri = lbryuri.build({ name: name }, false);
}
++pendingId;
const pendingPublishes = getLocal("pendingPublishes") || [];
const newPendingPublish = {
name,
channel_name,
claim_id: "pending-" + uri,
txid: "pending_" + uri,
claim_id: "pending-" + pendingId,
txid: "pending-" + pendingId,
nout: 0,
outpoint: "pending-" + uri + ":0",
outpoint: "pending-" + pendingId + ":0",
time: Date.now(),
};
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);
if (pathBadChars) {
throw new Error(
__(`Invalid character in path: %s`, nameBadChars.join(", "))
__(`Invalid character in path: %s`, pathBadChars.join(", "))
);
}