Add Gitea site/username to contributor serializer

This commit is contained in:
Basti 2019-04-23 20:28:56 +01:00
parent 542ebaf3f3
commit 09b78e1e8f
No known key found for this signature in database
GPG Key ID: BE4634D632D39B67

View File

@ -26,6 +26,7 @@ class Contributor {
url,
github_uid,
github_username,
gitea_username,
wiki_username,
} = this;
@ -50,6 +51,14 @@ class Contributor {
});
}
if (gitea_username) {
data.accounts.push({
"site": "gitea.kosmos.org",
"username": gitea_username,
"url": `https://gitea.kosmos.org/${gitea_username}`
});
}
if (wiki_username) {
data.accounts.push({
"site": "wiki.kosmos.org",
@ -87,13 +96,17 @@ class Contributor {
accounts,
} = JSON.parse(serialized.toString('utf8'));
let github_username, github_uid, wiki_username;
let github = accounts.find((a) => a.site === 'github.com');
let wiki = accounts.find((a) => a.site === 'wiki.kosmos.org');
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');
if (github) {
(({ username: github_username, uid: github_uid} = github));
}
if (gitea) {
(({ username: gitea_username } = gitea));
}
if (wiki) {
(({ username: wiki_username } = wiki));
}
@ -105,6 +118,7 @@ class Contributor {
accounts,
github_uid,
github_username,
gitea_username,
wiki_username,
ipfsData: serialized,
};