From f118f32139db97a7631d0c01c6d542cdef97491e Mon Sep 17 00:00:00 2001 From: Deviine Date: Sun, 27 Sep 2026 14:11:13 +0530 Subject: [PATCH] fix: use public avatars in open-source roster --- lib/oss-roster.test.ts | 26 ++++++++++++++++++++++++++ lib/oss-roster.ts | 4 +--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 lib/oss-roster.test.ts diff --git a/lib/oss-roster.test.ts b/lib/oss-roster.test.ts new file mode 100644 index 0000000..2c1adcf --- /dev/null +++ b/lib/oss-roster.test.ts @@ -0,0 +1,26 @@ +import { describe, expect, it, vi } from "vitest"; +import { ossRoster } from "./oss-roster"; + +vi.mock("@/lib/members", () => ({ + loadRoster: async () => [{ + name: "Nishtha Agarwal", + github: "nishtha-agarwal-211", + usn: "2102508773", + hasPhoto: true, + councilPosition: "Membership Lead", + }], + normalizeGithub: (value: string) => value, +})); + +describe("public open-source roster", () => { + it("uses a public avatar for a member with a private photo", async () => { + const roster = await ossRoster("second-year"); + const nishtha = roster.find( + (member) => member.github === "nishtha-agarwal-211", + ); + + expect(nishtha?.avatar).toBe( + "https://github.com/nishtha-agarwal-211.png", + ); + }); +}); \ No newline at end of file diff --git a/lib/oss-roster.ts b/lib/oss-roster.ts index 1fd4c1b..597181f 100644 --- a/lib/oss-roster.ts +++ b/lib/oss-roster.ts @@ -80,9 +80,7 @@ async function secondYear(): Promise { name: member.name, github: member.github, role: member.councilPosition ?? "Member", - avatar: member.hasPhoto - ? `/api/members/${member.usn}/avatar` - : `https://github.com/${member.github}.png`, + avatar: `https://github.com/${member.github}.png`, year: "second-year", }); }