Compare commits

...

3 Commits

Author SHA1 Message Date
Tom Moor bab2729669 Add optional chaining to avatarUrl check 2025-04-06 15:46:48 -07:00
Tom Moor 90f9721b40 Remove domain parameter and update avatarUrl check 2025-04-06 15:28:34 -07:00
codegen-sh[bot] dc474573c6 Remove avatars.ts, avatars.test.ts and update teamCreator.ts to remove generateAvatarUrl usage 2025-04-06 22:26:59 +00:00
3 changed files with 2 additions and 33 deletions
+2 -9
View File
@@ -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 */
@@ -29,20 +28,14 @@ type Props = {
async function teamCreator({
name,
domain,
subdomain,
avatarUrl,
authenticationProviders,
ip,
transaction,
}: Props): Promise<Team> {
// 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 (!avatarUrl || !avatarUrl.startsWith("http")) {
avatarUrl = await generateAvatarUrl({
domain,
id: subdomain,
});
if (!avatarUrl?.startsWith("http")) {
avatarUrl = null;
}
const team = await Team.create(
-9
View File
@@ -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);
});
-15
View File
@@ -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;
}