From 13ed02e1345343a0892b682e5a9f49d62ecd34f7 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 17 Sep 2019 17:24:35 +0200 Subject: [PATCH] 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. --- lib/serializers/contributor.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/serializers/contributor.js b/lib/serializers/contributor.js index dc9c708..d233759 100644 --- a/lib/serializers/contributor.js +++ b/lib/serializers/contributor.js @@ -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, }; }