Refactor getContributorById to be move generic #37

Merged
fsmanuel merged 2 commits from refactor/get-contributor-by-id into master 2018-04-07 23:32:46 +00:00
Showing only changes of commit 576313a7b0 - Show all commits
+5 -2
View File
@@ -118,7 +118,7 @@ export default Service.extend({
getContributorById(id) {
return this.get('contributorsContract')
.then((contract) => contract.getContributorById(id))
.then(this.replaceIpfsHash)
.then(this.reassembleIpfsHash)
// Set basic data
.then(({ account: address, balance, ipfsHash, isCore }) => {
let isCurrentUser = this.get('currentUserAccounts').includes(address);
3
@@ -157,9 +157,12 @@ export default Service.extend({
});
},
replaceIpfsHash(data) {
reassembleIpfsHash(data) {
let { ipfsHash: digest, hashFunction, hashSize } = data;
data.ipfsHash = fromBytes32({ digest, hashFunction, hashSize });
delete data.hashFunction;
delete data.hashSize;
return data;
},