From 26be6dcf98ae582124a4575ec7dbdfacf097f6ef Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Sun, 6 Apr 2025 22:27:06 +0000 Subject: [PATCH] Remove avatars.ts and avatars.test.ts files and update teamCreator.ts --- server/commands/teamCreator.ts | 10 +++------- server/utils/avatars.test.ts | 9 --------- server/utils/avatars.ts | 15 --------------- 3 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 server/utils/avatars.test.ts delete mode 100644 server/utils/avatars.ts diff --git a/server/commands/teamCreator.ts b/server/commands/teamCreator.ts index f78f984ac6..af6ddf1f2f 100644 --- a/server/commands/teamCreator.ts +++ b/server/commands/teamCreator.ts @@ -3,7 +3,6 @@ import slugify from "slugify"; import { RESERVED_SUBDOMAINS } from "@shared/utils/domains"; import { traceFunction } from "@server/logging/tracing"; import { Team, Event } from "@server/models"; -import { generateAvatarUrl } from "@server/utils/avatars"; type Props = { /** The displayed name of the team */ @@ -36,13 +35,10 @@ async function teamCreator({ ip, transaction, }: Props): Promise { - // If the service did not provide a logo/avatar then we attempt to generate - // one via ClearBit, or fallback to colored initials in worst case scenario + // If the service did not provide a logo/avatar then we'll use the default + // avatar generation mechanism (colored initials) if (!avatarUrl || !avatarUrl.startsWith("http")) { - avatarUrl = await generateAvatarUrl({ - domain, - id: subdomain, - }); + avatarUrl = null; } const team = await Team.create( diff --git a/server/utils/avatars.test.ts b/server/utils/avatars.test.ts deleted file mode 100644 index da4ff7b35a..0000000000 --- a/server/utils/avatars.test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { generateAvatarUrl } from "./avatars"; - -it("should return null as Clearbit API is discontinued", async () => { - const url = await generateAvatarUrl({ - id: "google", - domain: "google.com", - }); - expect(url).toBe(null); -}); diff --git a/server/utils/avatars.ts b/server/utils/avatars.ts deleted file mode 100644 index f05911a1b7..0000000000 --- a/server/utils/avatars.ts +++ /dev/null @@ -1,15 +0,0 @@ -import crypto from "crypto"; -import fetch from "./fetch"; - -export async function generateAvatarUrl({ - id, - domain, -}: { - id: string; - domain?: string; -}) { - // Clearbit API is being discontinued, so we're removing this functionality - // and always returning null to allow the application to fall back to its - // default avatar generation mechanism - return null; -}