Merge pull request #147 from lbryio/fix-my-claim-detection-publish

On Publish page, fix detection of the user's own claim on a name
This commit is contained in:
Jeremy Kauffman 2017-01-25 09:02:27 -05:00 committed by GitHub
commit b58748cfdb
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.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) { lbry.getKeyFee = function(name, callback, errorCallback) {

View file

@ -197,15 +197,14 @@ var PublishPage = React.createClass({
return; return;
} }
var topClaimIsMine = (myClaimInfo && myClaimInfo.amount >= claimInfo.amount); const topClaimIsMine = (myClaimInfo && myClaimInfo.amount >= claimInfo.amount);
const newState = {
var newState = {
name: name, name: name,
nameResolved: true, nameResolved: true,
topClaimValue: parseFloat(claimInfo.amount), topClaimValue: parseFloat(claimInfo.amount),
myClaimExists: !!myClaimInfo, myClaimExists: !!myClaimInfo,
myClaimValue: parseFloat(myClaimInfo.amount), myClaimValue: myClaimInfo ? parseFloat(myClaimInfo.amount) : null,
myClaimMetadata: myClaimInfo.value, myClaimMetadata: myClaimInfo ? myClaimInfo.value : null,
topClaimIsMine: topClaimIsMine, topClaimIsMine: topClaimIsMine,
}; };