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