From bd1cb8d84cfce2a990c6df159bc71e3889a02fb9 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 28 Aug 2024 16:31:39 +0200 Subject: [PATCH] refactor: Improve filtering of team contributors --- src/utils/GetRessources/GetContribs.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/GetRessources/GetContribs.tsx b/src/utils/GetRessources/GetContribs.tsx index 3705cb81..4b26071b 100644 --- a/src/utils/GetRessources/GetContribs.tsx +++ b/src/utils/GetRessources/GetContribs.tsx @@ -11,14 +11,14 @@ export async function getContributors (): Promise { try { const { data: allContributors } = await axios.get("https://api.github.com/repos/PapillonApp/Papillon/contributors"); - const teamGithubUrls = new Set( + const teamGithubUsernames = new Set( teams .filter((team): team is { name: string; description: string; link: string; ppimage: string; github: string } => Boolean(team.github)) - .map(({ github }) => github?.toLowerCase() ?? "") + .map(({ github }) => github.split("/").pop()?.toLowerCase() ?? "") ); - return allContributors.filter(({ html_url }) => - !teamGithubUrls.has(new URL(html_url).hostname.replace("www.", "")) + return allContributors.filter(({ login }) => + !teamGithubUsernames.has(login.toLowerCase()) ); } catch (error) { console.error("Erreur lors de la récupération des contributeurs:", error);