merge master

This commit is contained in:
2018-04-15 19:08:26 +02:00
9 changed files with 37 additions and 14 deletions
+4 -4
View File
@@ -9,7 +9,7 @@ export default Component.extend({
// Default attributes used by reset
attributes: {
account: null,
address: null,
name: null,
kind: 'person',
url: null,
@@ -24,9 +24,9 @@ export default Component.extend({
this.reset();
},
isValidAccount: computed('kredits.ethProvider', 'account', function() {
isValidAddress: computed('kredits.ethProvider', 'address', function() {
// TODO: add proper address validation
return this.get('account') !== '';
return this.get('address') !== '';
}),
isValidName: isPresent('name'),
isValidURL: isPresent('url'),
@@ -34,7 +34,7 @@ export default Component.extend({
isValidGithubUsername: isPresent('github_username'),
isValidWikiUsername: isPresent('wiki_username'),
isValid: and(
'isValidAccount',
'isValidAddress',
'isValidName',
'isValidGithubUID'
),
+3 -3
View File
@@ -9,11 +9,11 @@
</label>
</p>
<p>
{{input name="account"
{{input name="address"
type="text"
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
value=account
class=(if isValidAccount 'valid' '')}}
value=address
class=(if isValidAddress '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.account}}">Inspect Ethereum transactions</a></li>
<li><a href="https://testnet.etherscan.io/address/{{contributor.address}}">Inspect Ethereum transactions</a></li>
{{#if contributor.ipfsHash}}
<li><a href="https://ipfs.io/ipfs/{{contributor.ipfsHash}}">Inspect IPFS profile</a></li>
{{/if}}
+3 -2
View File
@@ -40,6 +40,7 @@ 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) {
@@ -78,10 +79,10 @@ export default Controller.extend({
_handleTransfer(from, to, value) {
value = value.toNumber();
this.get('contributors')
.findBy('account', from)
.findBy('address', from)
.decrementProperty('balance', value);
this.get('contributors')
.findBy('account', to)
.findBy('address', to)
.incrementProperty('balance', value);
},
+9 -1
View File
@@ -25,6 +25,14 @@ 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);
@@ -39,7 +47,7 @@ export default class Contributor extends Base {
.add(json)
.then((ipfsHashAttr) => {
let contributor = [
contributorAttr.account,
contributorAttr.address,
ipfsHashAttr.ipfsHash,
ipfsHashAttr.hashFunction,
ipfsHashAttr.hashSize,
+9 -1
View File
@@ -24,7 +24,15 @@ export default class Operator extends Base {
getById(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
.then((data) => {
return Kredits.ipfs.catAndMerge(data, ContributionSerializer.deserialize);
+2 -1
View File
@@ -5,7 +5,8 @@ import bignumber from 'kredits-web/utils/cps/bignumber';
export default EmberObject.extend({
// Contract
id: bignumber('idRaw', 'toString'),
account: null,
// TODO: Should we rename it to account like in the contract?
address: null,
balance: bignumber('balanceRaw', 'toNumber'),
isCore: false,
ipfsHash: null,
+5
View File
@@ -79,6 +79,11 @@ 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.account}}
Account: {{kredits.currentUser.address}}
{{/if}}
</section>
{{/if}}