Add support for zoom profils

This adds an accessor for the zoom_name to the contributor profile.
Doing this also removes general support for preserviing the contributor
accounts array as this was buggy and caused accounts to be added
multiple times.
This commit is contained in:
bumi 2019-09-17 17:24:35 +02:00
parent 48ff304861
commit 13ed02e134

View File

@ -27,8 +27,7 @@ class Contributor {
github_uid,
github_username,
gitea_username,
wiki_username,
accounts,
wiki_username
} = this;
let data = {
@ -36,7 +35,7 @@ class Contributor {
'@type': 'Contributor',
kind,
name,
accounts: accounts || [],
accounts: [],
};
if (url) {
@ -68,6 +67,13 @@ class Contributor {
});
}
if (zoom_name) {
data.accounts.push({
'site': 'zoom.us',
'username': zoom_name
});
}
// Write it pretty to ipfs
return JSON.stringify(data, null, 2);
}
@ -101,6 +107,7 @@ class Contributor {
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));
@ -111,6 +118,9 @@ class Contributor {
if (wiki) {
(({ username: wiki_username } = wiki));
}
if (zoom) {
(({ username: zoom_name } = zoom));
}
return {
name,
@ -121,6 +131,7 @@ class Contributor {
github_username,
gitea_username,
wiki_username,
zoom_name,
ipfsData: serialized,
};
}