Compare commits

..

1 Commits

Author SHA1 Message Date
basti a7c497da6a Return IPFS hash in addContribution() response
Needed in kredits-web. Useful for clients to identify contributions
before knowing their assigned ID.
2019-09-10 12:18:35 +02:00
10 changed files with 41426 additions and 23 deletions
-4
View File
@@ -1,4 +0,0 @@
template: |
## Changes
$CHANGES
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+8145
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -58,7 +58,10 @@ class Contribution extends Record {
ipfsHashAttr.hashSize,
];
return this.functions.add(...contribution, callOptions);
return this.functions.add(...contribution, callOptions).then(res => {
res.ipfsHash = this.ipfs.encodeHash(ipfsHashAttr);
return res;
});
});
}
+3 -15
View File
@@ -28,7 +28,7 @@ class Contributor {
github_username,
gitea_username,
wiki_username,
zoom_display_name,
accounts,
} = this;
let data = {
@@ -36,7 +36,7 @@ class Contributor {
'@type': 'Contributor',
kind,
name,
accounts: [],
accounts: accounts || [],
};
if (url) {
@@ -68,13 +68,6 @@ class Contributor {
});
}
if (zoom_display_name) {
data.accounts.push({
'site': 'zoom.us',
'username': zoom_display_name,
});
}
// Write it pretty to ipfs
return JSON.stringify(data, null, 2);
}
@@ -104,11 +97,10 @@ class Contributor {
accounts,
} = JSON.parse(serialized.toString('utf8'));
let github_username, github_uid, gitea_username, wiki_username, zoom_display_name;
let github_username, github_uid, gitea_username, wiki_username;
let github = accounts.find(a => a.site === 'github.com');
let gitea = accounts.find(a => a.site === 'gitea.kosmos.org');
let wiki = accounts.find(a => a.site === 'wiki.kosmos.org');
let zoom = accounts.find(a => a.site === 'zoom.us');
if (github) {
(({ username: github_username, uid: github_uid} = github));
@@ -119,9 +111,6 @@ class Contributor {
if (wiki) {
(({ username: wiki_username } = wiki));
}
if (zoom) {
(({ username: zoom_display_name } = zoom));
}
return {
name,
@@ -132,7 +121,6 @@ class Contributor {
github_username,
gitea_username,
wiki_username,
zoom_display_name,
ipfsData: serialized,
};
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "kredits-contracts",
"version": "5.5.0",
"version": "5.4.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -6132,4 +6132,4 @@
}
}
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "kredits-contracts",
"version": "5.5.0",
"version": "5.4.0",
"description": "Ethereum contracts and npm wrapper for Kredits",
"main": "./lib/kredits.js",
"directories": {
+8836
View File
File diff suppressed because it is too large Load Diff