Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove expired sponsors from sponsors list #273

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure we want to change the user here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we had the ddev org, some people had started sponsoring the project via the rfay account. This was also accounted for previously in the code here, but the logic was different. There are still 17 people and orgs sponsoring DDEV via the rfay account.

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