Publish: fix detection of the user's own claim on a name

This commit is contained in:
Alex Liebowitz 2017-01-25 00:34:18 -05:00
parent 51142dfc53
commit 7ac9c599de
2 changed files with 7 additions and 6 deletions

View file

@ -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) {

View file

@ -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,
};