From 0afbeea01ba5f33dd1eb74efe8d26e3d3b27d469 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Tue, 6 Jun 2017 19:57:24 +0200 Subject: [PATCH] Use newly generated UUID as ID for new contributor --- app/services/kredits.js | 5 ++++- package.json | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/services/kredits.js b/app/services/kredits.js index f5d9396..b6014ba 100644 --- a/app/services/kredits.js +++ b/app/services/kredits.js @@ -4,6 +4,7 @@ import config from 'kredits-web/config/environment'; import Contributor from 'kredits-web/models/contributor'; import Proposal from 'kredits-web/models/proposal'; import kreditsContracts from 'npm:kredits-contracts'; +import uuid from 'npm:uuid'; const { Service, @@ -183,10 +184,12 @@ export default Service.extend({ isCurrentUser: this.get('currentUserAccounts').includes(contributor.address) }); + let id = uuid.v4(); + return new Ember.RSVP.Promise((resolve, reject) => { this.get('ipfs').storeFile(contributor.serialize()).then(ipfsHash => { contributor.set('ipfsHash', ipfsHash); - this.get('kreditsContract').addContributor(contributor.address, contributor.name, contributor.ipfsHash, contributor.isCore, contributor.github_uid, (err, data) => { + this.get('kreditsContract').addContributor(contributor.address, contributor.name, contributor.ipfsHash, contributor.isCore, id, (err, data) => { if (err) { reject(err); return; } Ember.Logger.debug('[kredits] add contributor response', data); resolve(contributor); diff --git a/package.json b/package.json index dee8856..de892aa 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "kredits-contracts": "^2.4.0", "loader.js": "^4.0.10", "tv4": "^1.3.0", + "uuid": "^3.0.1", "web3": "^0.18.2" }, "engines": {