Better assign
This commit is contained in:
@@ -11,7 +11,7 @@ export default EmberObject.extend({
|
|||||||
github_uid: null,
|
github_uid: null,
|
||||||
wiki_username: null,
|
wiki_username: null,
|
||||||
profileHash: null,
|
profileHash: null,
|
||||||
balance: null,
|
balance: 0,
|
||||||
isCore: false,
|
isCore: false,
|
||||||
isCurrentUser: false,
|
isCurrentUser: false,
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -191,7 +191,7 @@ export default Service.extend({
|
|||||||
.then(ContributorSerializer.deserialize)
|
.then(ContributorSerializer.deserialize)
|
||||||
.then((attributes) => {
|
.then((attributes) => {
|
||||||
debug('[kredits] loaded contributor profile', attributes);
|
debug('[kredits] loaded contributor profile', attributes);
|
||||||
return Object.assign(data, attributes);
|
return Object.assign({}, data, attributes);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
error(
|
error(
|
||||||
@@ -293,28 +293,28 @@ export default Service.extend({
|
|||||||
|
|
||||||
return this.get('ipfs')
|
return this.get('ipfs')
|
||||||
.storeFile(json)
|
.storeFile(json)
|
||||||
|
// Set profileHash
|
||||||
.then((profileHash) => {
|
.then((profileHash) => {
|
||||||
// Set new attributes
|
|
||||||
attributes.profileHash = profileHash;
|
attributes.profileHash = profileHash;
|
||||||
attributes.balance = 0;
|
return attributes;
|
||||||
attributes.isCurrentUser = this.get('currentUserAccounts')
|
})
|
||||||
.includes(attributes.address);
|
.then((attributes) => {
|
||||||
|
|
||||||
return this.get('kreditsContract')
|
return this.get('kreditsContract')
|
||||||
.then((contract) => {
|
.then((contract) => {
|
||||||
let { address, isCore } = attributes;
|
let { address, isCore, profileHash } = attributes;
|
||||||
let {
|
let {
|
||||||
digest, hashFunction, size
|
digest, hashFunction, size
|
||||||
} = this.getBytes32FromMultihash(profileHash);
|
} = this.getBytes32FromMultihash(profileHash);
|
||||||
|
|
||||||
debug('[kredits] addContributor', address, digest, hashFunction, size, isCore);
|
let contributor = [
|
||||||
return contract.addContributor(
|
|
||||||
address,
|
address,
|
||||||
digest,
|
digest,
|
||||||
hashFunction,
|
hashFunction,
|
||||||
size,
|
size,
|
||||||
isCore
|
isCore,
|
||||||
);
|
];
|
||||||
|
debug('[kredits] addContributor', ...contributor);
|
||||||
|
return contract.addContributor(...contributor);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user