Adjust for new naming conventions #45

Merged
bumi merged 1 commits from refactor/naming-conventions into master 2018-04-15 16:24:17 +00:00
10 changed files with 15 additions and 39 deletions
Showing only changes of commit 7b5cea3613 - Show all commits
+4 -4
View File
@@ -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'
),
+3 -3
View File
@@ -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"}}>
+1 -1
View File
@@ -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}}
raucao commented 2018-04-10 17:09:09 +00:00 (Migrated from github.com)
Review

I don't fully understand why the address is called account now, because didn't we allow to change an address, specifically so that it is not the same as an account?

I don't fully understand why the address is called account now, because didn't we allow to change an address, specifically so that it is not the same as an account?
bumi commented 2018-04-10 17:13:19 +00:00 (Migrated from github.com)
Review

the change of an address is still supported (see the contracts)
the word address is reserved in solidity - it is the type. that's why we named the attribute account in the contract. To be consistent with the smart contract I changed it in the frontend also to to account and I think we should always use the word account.

the change of an address is still supported (see the contracts) the word `address` is reserved in solidity - it is the type. that's why we named the attribute `account` in the contract. To be consistent with the smart contract I changed it in the frontend also to to account and I think we should always use the word account.
raucao commented 2018-04-10 18:09:36 +00:00 (Migrated from github.com)
Review

Ah ok. I find it a bit misleading as a term for a single property of an account/person, but better that it's the same on both sides for sure.

Ah ok. I find it a bit misleading as a term for a single property of an account/person, but better that it's the same on both sides for sure.
bumi commented 2018-04-10 18:19:51 +00:00 (Migrated from github.com)
Review

it is account because ethereum talks about accounts - and it is the ethereum account of that contributor. - but ethereumAccount is a bit long.

it is account because ethereum talks about accounts - and it is the ethereum account of that contributor. - but ethereumAccount is a bit long.
raucao commented 2018-04-10 19:32:44 +00:00 (Migrated from github.com)
Review

Makes sense.

Makes sense.
<li><a href="https://ipfs.io/ipfs/{{contributor.ipfsHash}}">Inspect IPFS profile</a></li>
{{/if}}
+2 -4
View File
@@ -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);
},
+1 -9
View File
@@ -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,
+1 -9
View File
@@ -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);
+1 -2
View File
@@ -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,
+1 -1
View File
@@ -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'),
-5
View File
@@ -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;
},
+1 -1
View File
@@ -5,7 +5,7 @@
{{#if kredits.currentUserIsCore }}
(core)
{{/if}}
Account: {{kredits.currentUser.address}}
Account: {{kredits.currentUser.account}}
{{/if}}
</section>
{{/if}}