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:
2019-09-17 17:24:35 +02:00
父節點 48ff304861
當前提交 13ed02e134

查看文件

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