Skip to content

Commit

Permalink
fix: use sponsor's GitHub username when name is missing (#392)
Browse files Browse the repository at this point in the history
* fix: set fallback value

* fix: set fallback for name

* revert change to sponsors.html

* set another fallback

* clean up dirty data
  • Loading branch information
chenxsan committed Dec 25, 2022
1 parent cd03054 commit 17a9cd8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 40 deletions.
11 changes: 1 addition & 10 deletions src/_data/donations.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,6 @@
"date": "2022-02-21T11:46:53.444Z",
"source": "opencollective"
},
{
"id": "SA_kwHOAFvahM4ABIzq",
"name": null,
"image": "https://avatars.githubusercontent.com/u/23113912?u=8f0f72610d5ec4a8bd382680e693984210b1cf18&v=4",
"url": "https://github.com/ndNovaDev",
"amount": 10,
"date": "2022-12-24T02:22:57Z",
"source": "github"
},
{
"id": "SA_kwHOAFvahM4ABHcn",
"name": "Gabriel Gregório",
Expand All @@ -269,4 +260,4 @@
"date": "2022-12-07T23:22:34Z",
"source": "github"
}
]
]
26 changes: 1 addition & 25 deletions src/_data/sponsors.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,6 @@
"source": "github",
"tier": "backer"
},
{
"name": null,
"image": "https://avatars.githubusercontent.com/u/23113912?u=8f0f72610d5ec4a8bd382680e693984210b1cf18&v=4",
"url": "https://github.com/ndNovaDev",
"monthlyDonation": 10,
"source": "github",
"tier": "backer"
},
{
"name": "Raimonds Korzenevskis",
"image": "https://avatars.githubusercontent.com/u/28185559?u=4e564dd0947ebc75d9fe02a90b7149256a48164e&v=4",
Expand Down Expand Up @@ -1228,14 +1220,6 @@
"source": "github",
"tier": "backer"
},
{
"name": null,
"image": "https://avatars.githubusercontent.com/u/8572152?v=4",
"url": "https://github.com/per1234",
"monthlyDonation": 5,
"source": "github",
"tier": "backer"
},
{
"name": "Gabi",
"image": "https://avatars.githubusercontent.com/u/9082013?u=0a2400198d68bd7155832384f6135c22aefa6f4b&v=4",
Expand Down Expand Up @@ -1324,14 +1308,6 @@
"source": "github",
"tier": "backer"
},
{
"name": null,
"image": "https://avatars.githubusercontent.com/u/19206886?u=5302740136db6d2fe4d4009680064ce95a1896fc&v=4",
"url": "https://github.com/portfine",
"monthlyDonation": 5,
"source": "github",
"tier": "backer"
},
{
"name": "BrightCrowd",
"image": "https://avatars.githubusercontent.com/u/19253501?v=4",
Expand Down Expand Up @@ -1529,4 +1505,4 @@
"tier": "backer"
}
]
}
}
10 changes: 5 additions & 5 deletions tools/fetch-sponsors.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ async function fetchGitHubSponsors() {
// return an array in the same format as Open Collective
const sponsors = organization.sponsorshipsAsMaintainer.nodes
.map(({ sponsor, tier }) => ({
name: sponsor.name,
name: sponsor.name || sponsor.login,
image: sponsor.avatarUrl,
url: sponsor.websiteUrl || sponsor.url,
monthlyDonation: tier.monthlyPriceInDollars,
Expand All @@ -239,7 +239,7 @@ async function fetchGitHubSponsors() {
.filter(transaction => transaction.tier && transaction.tier.isOneTime)
.map(({ sponsor, timestamp, tier, id }) => ({
id,
name: sponsor.name,
name: sponsor.name || sponsor.login,
image: sponsor.avatarUrl,
url: sponsor.websiteUrl || sponsor.url,
amount: tier.monthlyPriceInDollars,
Expand All @@ -249,7 +249,7 @@ async function fetchGitHubSponsors() {
.filter(donation => {
// invoiced recurring donations are incorrectly marked as one-time
const sponsor = sponsors.find(sponsor => sponsor.name === donation.name);

// only include if the amount is different than the monthly amount
return sponsor ? sponsor.monthlyDonation !== donation.amount : true;
});
Expand All @@ -273,11 +273,11 @@ async function fetchGitHubSponsors() {
{
sponsors: openCollectiveSponsors,
donations: openCollectiveDonations
},
},
{
sponsors: githubSponsors,
donations: githubDonations
},
},
] = await Promise.all([
fetchOpenCollectiveData(),
fetchGitHubSponsors()
Expand Down

0 comments on commit 17a9cd8

Please sign in to comment.