Revert "Adjust for new naming conventions"
This commit is contained in:
@@ -9,7 +9,7 @@ export default Component.extend({
|
|||||||
|
|
||||||
// Default attributes used by reset
|
// Default attributes used by reset
|
||||||
attributes: {
|
attributes: {
|
||||||
account: null,
|
address: 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();
|
||||||
},
|
},
|
||||||
|
|
||||||
isValidAccount: computed('kredits.ethProvider', 'account', function() {
|
isValidAddress: computed('kredits.ethProvider', 'address', function() {
|
||||||
// TODO: add proper address validation
|
// TODO: add proper address validation
|
||||||
return this.get('account') !== '';
|
return this.get('address') !== '';
|
||||||
}),
|
}),
|
||||||
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(
|
||||||
'isValidAccount',
|
'isValidAddress',
|
||||||
'isValidName',
|
'isValidName',
|
||||||
'isValidGithubUID'
|
'isValidGithubUID'
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{{input name="account"
|
{{input name="address"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
|
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
|
||||||
value=account
|
value=address
|
||||||
class=(if isValidAccount 'valid' '')}}
|
class=(if isValidAddress 'valid' '')}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<select required onchange={{action (mut kind) value="target.value"}}>
|
<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'}}">
|
<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.account}}">Inspect Ethereum transactions</a></li>
|
<li><a href="https://testnet.etherscan.io/address/{{contributor.address}}">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}}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ 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) {
|
||||||
@@ -52,6 +53,7 @@ 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());
|
||||||
|
|
||||||
@@ -78,10 +80,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('account', from)
|
.findBy('address', from)
|
||||||
.decrementProperty('balance', value);
|
.decrementProperty('balance', value);
|
||||||
this.get('contributors')
|
this.get('contributors')
|
||||||
.findBy('account', to)
|
.findBy('address', to)
|
||||||
.incrementProperty('balance', value);
|
.incrementProperty('balance', value);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ 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);
|
||||||
@@ -39,7 +47,7 @@ export default class Contributor extends Base {
|
|||||||
.add(json)
|
.add(json)
|
||||||
.then((ipfsHashAttr) => {
|
.then((ipfsHashAttr) => {
|
||||||
let contributor = [
|
let contributor = [
|
||||||
contributorAttr.account,
|
contributorAttr.address,
|
||||||
ipfsHashAttr.ipfsHash,
|
ipfsHashAttr.ipfsHash,
|
||||||
ipfsHashAttr.hashFunction,
|
ipfsHashAttr.hashFunction,
|
||||||
ipfsHashAttr.hashSize,
|
ipfsHashAttr.hashSize,
|
||||||
|
|||||||
@@ -24,7 +24,15 @@ export default class Operator extends Base {
|
|||||||
getById(id) {
|
getById(id) {
|
||||||
id = ethers.utils.bigNumberify(id);
|
id = ethers.utils.bigNumberify(id);
|
||||||
|
|
||||||
return this.functions.getProposal(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;
|
||||||
|
})
|
||||||
// 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);
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ 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'),
|
||||||
account: null,
|
// TODO: Should we rename it to account like in the contract?
|
||||||
|
address: null,
|
||||||
balance: bignumber('balanceRaw', 'toNumber'),
|
balance: bignumber('balanceRaw', 'toNumber'),
|
||||||
isCore: false,
|
isCore: false,
|
||||||
ipfsHash: null,
|
ipfsHash: null,
|
||||||
|
|||||||
@@ -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'),
|
||||||
creatorAccount: null,
|
creatorAddress: 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'),
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ 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;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{{#if kredits.currentUserIsCore }}
|
{{#if kredits.currentUserIsCore }}
|
||||||
(core)
|
(core)
|
||||||
{{/if}}
|
{{/if}}
|
||||||
Account: {{kredits.currentUser.account}}
|
Account: {{kredits.currentUser.address}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
Reference in New Issue
Block a user