From 7ac9c599dee5b11ef6cbd92c356834d2ec60c29c Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Wed, 25 Jan 2017 00:34:18 -0500 Subject: [PATCH] Publish: fix detection of the user's own claim on a name --- js/lbry.js | 4 +++- js/page/publish.js | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/js/lbry.js b/js/lbry.js index f911a29ab..02bc906c5 100644 --- a/js/lbry.js +++ b/js/lbry.js @@ -176,7 +176,9 @@ lbry.getClaimInfo = function(name, callback) { } lbry.getMyClaim = function(name, callback) { - lbry.call('get_my_claim', { name: name }, callback); + lbry.call('claim_list_mine', {}, (claims) => { + callback(claims.find((claim) => claim.name == name) || null); + }); } lbry.getKeyFee = function(name, callback, errorCallback) { diff --git a/js/page/publish.js b/js/page/publish.js index 8e3ede775..d1d48bc3a 100644 --- a/js/page/publish.js +++ b/js/page/publish.js @@ -197,15 +197,14 @@ var PublishPage = React.createClass({ return; } - var topClaimIsMine = (myClaimInfo && myClaimInfo.amount >= claimInfo.amount); - - var newState = { + const topClaimIsMine = (myClaimInfo && myClaimInfo.amount >= claimInfo.amount); + const newState = { name: name, nameResolved: true, topClaimValue: parseFloat(claimInfo.amount), myClaimExists: !!myClaimInfo, - myClaimValue: parseFloat(myClaimInfo.amount), - myClaimMetadata: myClaimInfo.value, + myClaimValue: myClaimInfo ? parseFloat(myClaimInfo.amount) : null, + myClaimMetadata: myClaimInfo ? myClaimInfo.value : null, topClaimIsMine: topClaimIsMine, };