Correct and simplify metadata processing in dummy pending publishes

This commit is contained in:
Alex Liebowitz 2017-04-13 20:56:58 -04:00 committed by Jeremy Kauffman
parent 9b4d8ec266
commit d926967e49
2 changed files with 12 additions and 8 deletions

View file

@ -182,7 +182,7 @@ let FileActionsRow = React.createClass({
<Modal isOpen={this.state.modal == 'confirmRemove'} contentLabel="Not enough credits"
type="confirm" confirmButtonLabel="Remove" onConfirmed={this.handleRemoveConfirmed}
onAborted={this.closeModal}>
<p>Are you sure you'd like to remove <cite>{this.props.metadata.title}</cite> from LBRY?</p>
<p>Are you sure you'd like to remove <cite>{this.props.metadata ? this.props.metadata.title : this.props.uri}</cite> from LBRY?</p>
<label><FormField type="checkbox" checked={this.state.deleteChecked} onClick={this.handleDeleteCheckboxClicked} /> Delete this file from my computer</label>
</Modal>

View file

@ -11,7 +11,12 @@ const menu = remote.require('./menu/main-menu');
* needed to make a dummy claim or file info object.
*/
function savePendingPublish({name, channel_name}) {
const lbryUri = uri.buildLbryUri({name, channel_name}, false);
let lbryUri;
if (channel_name) {
lbryUri = uri.buildLbryUri({name: channel_name, path: name}, false);
} else {
lbryUri = uri.buildLbryUri({name: name}, false);
}
const pendingPublishes = getLocal('pendingPublishes') || [];
const newPendingPublish = {
name, channel_name,
@ -61,13 +66,13 @@ function getPendingPublish({name, channel_name, outpoint}) {
}
function pendingPublishToDummyClaim({channel_name, name, outpoint, claim_id, txid, nout}) {
return {name, outpoint, claim_id, txid, nout, ... channel_name ? {channel_name} : {}};
return {name, outpoint, claim_id, txid, nout, channel_name};
}
function pendingPublishToDummyFileInfo({name, outpoint, claim_id}) {
return {name, outpoint, claim_id, null};
return {name, outpoint, claim_id, metadata: null};
}
window.pptdfi = pendingPublishToDummyFileInfo;
let lbry = {
isConnected: false,
@ -316,14 +321,13 @@ lbry.publish = function(params, fileListedCallback, publishedCallback, errorCall
returnedPending = true;
if (publishedCallback) {
const {name, channel_name} = params;
savePendingPublish({name, ... channel_name ? {channel_name} : {}});
savePendingPublish({name: params.name, channel_name: params.channel_name});
publishedCallback(true);
}
if (fileListedCallback) {
const {name, channel_name} = params;
savePendingPublish({name, ... channel_name ? {channel_name} : {}});
savePendingPublish({name: params.name, channel_name: params.channel_name});
fileListedCallback(true);
}
}, 2000);