From d926967e49dd76e786755794ed66ad8e04ed11d0 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Thu, 13 Apr 2017 20:56:58 -0400 Subject: [PATCH] Correct and simplify metadata processing in dummy pending publishes --- ui/js/component/file-actions.js | 2 +- ui/js/lbry.js | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ui/js/component/file-actions.js b/ui/js/component/file-actions.js index d12e4525f..d16e61bab 100644 --- a/ui/js/component/file-actions.js +++ b/ui/js/component/file-actions.js @@ -182,7 +182,7 @@ let FileActionsRow = React.createClass({ -

Are you sure you'd like to remove {this.props.metadata.title} from LBRY?

+

Are you sure you'd like to remove {this.props.metadata ? this.props.metadata.title : this.props.uri} from LBRY?

diff --git a/ui/js/lbry.js b/ui/js/lbry.js index b09aabe1f..9e8b1565e 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -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);