Adjust for new naming conventions

This commit is contained in:
2018-04-10 18:46:54 +02:00
parent 5d875d23e2
commit 7b5cea3613
10 changed files with 15 additions and 39 deletions
+4 -4
View File
@@ -9,7 +9,7 @@ export default Component.extend({
// Default attributes used by reset // Default attributes used by reset
attributes: { attributes: {
address: null, account: null,
name: null, name: null,
kind: 'person', kind: 'person',
url: null, url: null,
@@ -24,9 +24,9 @@ export default Component.extend({
this.reset(); this.reset();
}, },
isValidAddress: computed('kredits.ethProvider', 'address', function() { isValidAccount: computed('kredits.ethProvider', 'account', function() {
// TODO: add proper address validation // TODO: add proper address validation
return this.get('address') !== ''; return this.get('account') !== '';
}), }),
isValidName: isPresent('name'), isValidName: isPresent('name'),
isValidURL: isPresent('url'), isValidURL: isPresent('url'),
@@ -34,7 +34,7 @@ export default Component.extend({
isValidGithubUsername: isPresent('github_username'), isValidGithubUsername: isPresent('github_username'),
isValidWikiUsername: isPresent('wiki_username'), isValidWikiUsername: isPresent('wiki_username'),
isValid: and( isValid: and(
'isValidAddress', 'isValidAccount',
'isValidName', 'isValidName',
'isValidGithubUID' 'isValidGithubUID'
), ),
+3 -3
View File
@@ -9,11 +9,11 @@
</label> </label>
</p> </p>
<p> <p>
{{input name="address" {{input name="account"
type="text" type="text"
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4" placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
value=address value=account
class=(if isValidAddress 'valid' '')}} class=(if isValidAccount 'valid' '')}}
</p> </p>
<p> <p>
<select required onchange={{action (mut kind) value="target.value"}}> <select required onchange={{action (mut kind) value="target.value"}}>
+1 -1
View File
@@ -13,7 +13,7 @@
<tr class="metadata {{if contributor.isCurrentUser 'current-user'}} {{if contributor.showMetadata 'visible'}}"> <tr class="metadata {{if contributor.isCurrentUser 'current-user'}} {{if contributor.showMetadata 'visible'}}">
<td colspan="2"> <td colspan="2">
<ul> <ul>
<li><a href="https://testnet.etherscan.io/address/{{contributor.address}}">Inspect Ethereum transactions</a></li> <li><a href="https://testnet.etherscan.io/address/{{contributor.account}}">Inspect Ethereum transactions</a></li>
{{#if contributor.ipfsHash}} {{#if contributor.ipfsHash}}
<li><a href="https://ipfs.io/ipfs/{{contributor.ipfsHash}}">Inspect IPFS profile</a></li> <li><a href="https://ipfs.io/ipfs/{{contributor.ipfsHash}}">Inspect IPFS profile</a></li>
{{/if}} {{/if}}
+2 -4
View File
@@ -40,7 +40,6 @@ export default Controller.extend({
proposalsOpenSorted: sort('proposalsOpen', 'proposalsSorting'), proposalsOpenSorted: sort('proposalsOpen', 'proposalsSorting'),
_handleProposalCreated(proposalId) { _handleProposalCreated(proposalId) {
// TODO: check if proposalId is already a string
let proposal = this.get('proposals') let proposal = this.get('proposals')
.findBy('id', proposalId.toString()); .findBy('id', proposalId.toString());
if (proposal) { if (proposal) {
@@ -53,7 +52,6 @@ export default Controller.extend({
}, },
_handleProposalExecuted(proposalId, recipientId, amount) { _handleProposalExecuted(proposalId, recipientId, amount) {
// TODO: check if proposalId is already a string
let proposal = this.get('proposals') let proposal = this.get('proposals')
.findBy('id', proposalId.toString()); .findBy('id', proposalId.toString());
@@ -80,10 +78,10 @@ export default Controller.extend({
_handleTransfer(from, to, value) { _handleTransfer(from, to, value) {
value = value.toNumber(); value = value.toNumber();
this.get('contributors') this.get('contributors')
.findBy('address', from) .findBy('account', from)
.decrementProperty('balance', value); .decrementProperty('balance', value);
this.get('contributors') this.get('contributors')
.findBy('address', to) .findBy('account', to)
.incrementProperty('balance', value); .incrementProperty('balance', value);
}, },
+1 -9
View File
@@ -25,14 +25,6 @@ export default class Contributor extends Base {
id = ethers.utils.bigNumberify(id); id = ethers.utils.bigNumberify(id);
return this.functions.getContributorById(id) return this.functions.getContributorById(id)
.then((data) => {
// TODO: remove as soon as the contract provides the id
data.id = id;
// TODO: rename address to account
data.address = data.account;
return data;
})
// Fetch IPFS data if available // Fetch IPFS data if available
.then((data) => { .then((data) => {
return Kredits.ipfs.catAndMerge(data, ContributorSerializer.deserialize); return Kredits.ipfs.catAndMerge(data, ContributorSerializer.deserialize);
@@ -47,7 +39,7 @@ export default class Contributor extends Base {
.add(json) .add(json)
.then((ipfsHashAttr) => { .then((ipfsHashAttr) => {
let contributor = [ let contributor = [
contributorAttr.address, contributorAttr.account,
ipfsHashAttr.ipfsHash, ipfsHashAttr.ipfsHash,
ipfsHashAttr.hashFunction, ipfsHashAttr.hashFunction,
ipfsHashAttr.hashSize, ipfsHashAttr.hashSize,
+1 -9
View File
@@ -24,15 +24,7 @@ export default class Operator extends Base {
getById(id) { getById(id) {
id = ethers.utils.bigNumberify(id); id = ethers.utils.bigNumberify(id);
return this.functions.proposals(id) return this.functions.getProposal(id)
.then((data) => {
// TODO: remove as soon as the contract provides the id
data.id = id;
// TODO: rename creatorAddress to creator
data.creatorAddress = data.creator;
return data;
})
// Fetch IPFS data if available // Fetch IPFS data if available
.then((data) => { .then((data) => {
return Kredits.ipfs.catAndMerge(data, ContributionSerializer.deserialize); return Kredits.ipfs.catAndMerge(data, ContributionSerializer.deserialize);
+1 -2
View File
@@ -5,8 +5,7 @@ import bignumber from 'kredits-web/utils/cps/bignumber';
export default EmberObject.extend({ export default EmberObject.extend({
// Contract // Contract
id: bignumber('idRaw', 'toString'), id: bignumber('idRaw', 'toString'),
// TODO: Should we rename it to account like in the contract? account: null,
address: null,
balance: bignumber('balanceRaw', 'toNumber'), balance: bignumber('balanceRaw', 'toNumber'),
isCore: false, isCore: false,
ipfsHash: null, ipfsHash: null,
+1 -1
View File
@@ -5,7 +5,7 @@ import bignumber from 'kredits-web/utils/cps/bignumber';
export default EmberObject.extend({ export default EmberObject.extend({
// Contract // Contract
id: bignumber('idRaw', 'toString'), id: bignumber('idRaw', 'toString'),
creatorAddress: null, creatorAccount: null,
recipientId: bignumber('recipientIdRaw', 'toString'), recipientId: bignumber('recipientIdRaw', 'toString'),
amount: bignumber('amountRaw', 'toNumber'), amount: bignumber('amountRaw', 'toNumber'),
votesCount: bignumber('votesCountRaw', 'toNumber'), votesCount: bignumber('votesCountRaw', 'toNumber'),
-5
View File
@@ -79,11 +79,6 @@ export default Service.extend({
debug('[kredits] build', name, attributes); debug('[kredits] build', name, attributes);
let model = getOwner(this).lookup(`model:${name}`); let model = getOwner(this).lookup(`model:${name}`);
// coerce id to string
if (attributes.id) {
attributes.id = attributes.id.toString();
}
model.setProperties(attributes); model.setProperties(attributes);
return model; return model;
}, },
+1 -1
View File
@@ -5,7 +5,7 @@
{{#if kredits.currentUserIsCore }} {{#if kredits.currentUserIsCore }}
(core) (core)
{{/if}} {{/if}}
Account: {{kredits.currentUser.address}} Account: {{kredits.currentUser.account}}
{{/if}} {{/if}}
</section> </section>
{{/if}} {{/if}}