From 13ed02e1345343a0892b682e5a9f49d62ecd34f7 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 17 Sep 2019 17:24:35 +0200 Subject: [PATCH 1/3] 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, }; } From aba4a23104807a650df2d9f40a56742ffb4b462f Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 17 Sep 2019 18:30:19 +0200 Subject: [PATCH 2/3] Fixes & linting --- lib/serializers/contributor.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/serializers/contributor.js b/lib/serializers/contributor.js index d233759..efd30e4 100644 --- a/lib/serializers/contributor.js +++ b/lib/serializers/contributor.js @@ -27,7 +27,8 @@ class Contributor { github_uid, github_username, gitea_username, - wiki_username + wiki_username, + zoom_name, } = this; let data = { @@ -70,7 +71,7 @@ class Contributor { if (zoom_name) { data.accounts.push({ 'site': 'zoom.us', - 'username': zoom_name + 'username': zoom_name, }); } @@ -103,7 +104,7 @@ class Contributor { accounts, } = JSON.parse(serialized.toString('utf8')); - let github_username, github_uid, gitea_username, wiki_username; + let github_username, github_uid, gitea_username, wiki_username, zoom_name; 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'); From 66a37a1e74f2fcbeb548bd59ca276bde835c1ed7 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Wed, 18 Sep 2019 08:44:13 +0200 Subject: [PATCH 3/3] Improve property name --- lib/serializers/contributor.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/serializers/contributor.js b/lib/serializers/contributor.js index efd30e4..ec27416 100644 --- a/lib/serializers/contributor.js +++ b/lib/serializers/contributor.js @@ -28,7 +28,7 @@ class Contributor { github_username, gitea_username, wiki_username, - zoom_name, + zoom_display_name, } = this; let data = { @@ -68,10 +68,10 @@ class Contributor { }); } - if (zoom_name) { + if (zoom_display_name) { data.accounts.push({ 'site': 'zoom.us', - 'username': zoom_name, + 'username': zoom_display_name, }); } @@ -104,7 +104,7 @@ class Contributor { accounts, } = JSON.parse(serialized.toString('utf8')); - let github_username, github_uid, gitea_username, wiki_username, zoom_name; + let github_username, github_uid, gitea_username, wiki_username, zoom_display_name; 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'); @@ -120,7 +120,7 @@ class Contributor { (({ username: wiki_username } = wiki)); } if (zoom) { - (({ username: zoom_name } = zoom)); + (({ username: zoom_display_name } = zoom)); } return { @@ -132,7 +132,7 @@ class Contributor { github_username, gitea_username, wiki_username, - zoom_name, + zoom_display_name, ipfsData: serialized, }; }