Use newly generated UUID as ID for new contributor
This commit is contained in:
@@ -4,6 +4,7 @@ import config from 'kredits-web/config/environment';
|
|||||||
import Contributor from 'kredits-web/models/contributor';
|
import Contributor from 'kredits-web/models/contributor';
|
||||||
import Proposal from 'kredits-web/models/proposal';
|
import Proposal from 'kredits-web/models/proposal';
|
||||||
import kreditsContracts from 'npm:kredits-contracts';
|
import kreditsContracts from 'npm:kredits-contracts';
|
||||||
|
import uuid from 'npm:uuid';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Service,
|
Service,
|
||||||
@@ -183,10 +184,12 @@ export default Service.extend({
|
|||||||
isCurrentUser: this.get('currentUserAccounts').includes(contributor.address)
|
isCurrentUser: this.get('currentUserAccounts').includes(contributor.address)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let id = uuid.v4();
|
||||||
|
|
||||||
return new Ember.RSVP.Promise((resolve, reject) => {
|
return new Ember.RSVP.Promise((resolve, reject) => {
|
||||||
this.get('ipfs').storeFile(contributor.serialize()).then(ipfsHash => {
|
this.get('ipfs').storeFile(contributor.serialize()).then(ipfsHash => {
|
||||||
contributor.set('ipfsHash', 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; }
|
if (err) { reject(err); return; }
|
||||||
Ember.Logger.debug('[kredits] add contributor response', data);
|
Ember.Logger.debug('[kredits] add contributor response', data);
|
||||||
resolve(contributor);
|
resolve(contributor);
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
"kredits-contracts": "^2.4.0",
|
"kredits-contracts": "^2.4.0",
|
||||||
"loader.js": "^4.0.10",
|
"loader.js": "^4.0.10",
|
||||||
"tv4": "^1.3.0",
|
"tv4": "^1.3.0",
|
||||||
|
"uuid": "^3.0.1",
|
||||||
"web3": "^0.18.2"
|
"web3": "^0.18.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
Reference in New Issue
Block a user