Mark current user in contrib list if available

This commit is contained in:
2017-02-08 14:22:49 +08:00
parent ad76fb2369
commit cd6fbfe17c
4 changed files with 41 additions and 26 deletions
+8 -2
View File
@@ -33,6 +33,10 @@ export default Ember.Service.extend({
return web3Instance;
}.property('web3Instance'),
currentUserAccounts: function() {
return (this.get('web3Provided') && this.get('web3').eth.accounts) || [];
}.property('web3', 'web3Provided'),
kreditsContract: function() {
if (this.get('kreditsContractInstance')) {
return this.get('kreditsContractInstance');
@@ -64,7 +68,8 @@ export default Ember.Service.extend({
github_username: person[1],
github_uid: person[0],
ipfsHash: person[3],
kredits: balance.toNumber()
kredits: balance.toNumber(),
isCurrentUser: this.get('currentUserAccounts').includes(address)
});
Ember.Logger.debug('[kredits] contributor', contributor);
resolve(contributor);
@@ -142,7 +147,8 @@ export default Ember.Service.extend({
github_username: name,
github_uid: id,
ipfsHash: ipfsHash,
kredits: 0
kredits: 0,
isCurrentUser: this.get('currentUserAccounts').includes(address)
});
resolve(contributor);
});