Skip to content

Commit

Permalink
Remove expired sponsors from sponsors list (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay authored Nov 11, 2024
1 parent 7709d44 commit 1676416
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 72 deletions.
36 changes: 0 additions & 36 deletions src/featured-sponsors.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,6 @@
"url": "https://openstrategypartners.com/",
"github": "open-strategy-partners"
},
{
"name": "1xINTERNET",
"type": "standard",
"logo": "/logos/1xinternet.svg",
"darklogo": "/logos/1xinternet.svg",
"squareLogo": "/logos/1xinternet-square.svg",
"url": "https://1xinternet.de",
"github": "1xINTERNET"
},
{
"name": "Amazee.io",
"type": "standard",
"logo": "/logos/amazee-io-Mirantis-Logo-Black-White-IO.svg",
"darklogo": "/logos/amazee-io-mirantis-darkmode.svg",
"squareLogo": "/logos/amazee-io-square.svg",
"url": "https://amazee.io/",
"github": "amazee.io"
},
{
"name": "Agaric",
"type": "standard",
Expand Down Expand Up @@ -105,15 +87,6 @@
"url": "https://gizra.com/",
"github": "gizra"
},
{
"name": "DrupalEasy",
"type": "standard",
"logo": "/logos/drupaleasy.png",
"darklogo": "/logos/drupaleasy-darkmode.png",
"squareLogo": "/logos/drupaleasy-square.svg",
"url": "https://www.drupaleasy.com/",
"github": "drupaleasy"
},
{
"name": "mobilistics",
"type": "standard",
Expand Down Expand Up @@ -175,14 +148,5 @@
"squareLogo": "/logos/craft-cms-square.svg",
"url": "https://craftcms.com/",
"github": "craftcms"
},
{
"name": "undpaul",
"type": "standard",
"logo": "/logos/undpaul.svg",
"darklogo": "/logos/undpaul-darkmode.svg",
"squareLogo": "/logos/undpaul-square.svg",
"url": "https://undpaul.de",
"github": "undpaul"
}
]
74 changes: 38 additions & 36 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,55 +85,57 @@ export async function getSponsors() {
}

const response = await octokit().graphql(`
query {
user(login: "rfay") {
... on Sponsorable {
sponsors(first: 100) {
totalCount
nodes {
... on User {
login
url
avatarUrl
}
... on Organization {
login
url
avatarUrl
}
query CombinedSponsors {
org: organization(login: "ddev") {
sponsors(first: 100) {
nodes {
... on User {
login
url
avatarUrl
}
... on Organization {
login
url
avatarUrl
}
}
}
}
organization(login: "ddev") {
... on Sponsorable {
sponsors(first: 100) {
totalCount
nodes {
... on User {
login
url
avatarUrl
}
... on Organization {
login
url
avatarUrl
}
user: user(login: "rfay") {
sponsors(first: 100) {
nodes {
... on User {
login
url
avatarUrl
}
... on Organization {
login
url
avatarUrl
}
}
}
}
}
`)

const rfayData = response.user.sponsors.nodes
const orgData = response.organization.sponsors.nodes
const data = [...rfayData, ...orgData]
// Combine sponsors from both sources and remove duplicates
const allSponsors = [
...response.org.sponsors.nodes,
...response.user.sponsors.nodes
].reduce((unique, sponsor) => {
// Use login as unique identifier
if (!unique.some(item => item.login === sponsor.login)) {
unique.push(sponsor)
}
return unique
}, [])

putCache(cacheFilename, JSON.stringify(data))
putCache(cacheFilename, JSON.stringify(allSponsors))

return data
return allSponsors
}

/**
Expand Down

0 comments on commit 1676416

Please sign in to comment.