From eb5769fa99435baedcb96fa6082f53818b6c3556 Mon Sep 17 00:00:00 2001 From: Benjamin Zelnick <34197604+ZelnickB@users.noreply.github.com> Date: Sun, 15 Sep 2024 02:07:18 -0400 Subject: [PATCH] Fix `student_year` type in 2028-specific code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the class of 2028 server-specific code so that the `student_year` property from the MIT directory query results is compared to the string `’1’` rather than the number `1`. This corrects a glitch that was assigning class of 2028 members the role for upperclassmen. --- routes/api/verification/confirm.endpoint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/api/verification/confirm.endpoint.js b/routes/api/verification/confirm.endpoint.js index 49f6ca5..bdaa01e 100644 --- a/routes/api/verification/confirm.endpoint.js +++ b/routes/api/verification/confirm.endpoint.js @@ -153,7 +153,7 @@ export function get (req, res) { const [petrockUserInfo, discordUserInfo] = val[0].value // BEGIN CLASS OF 2028 SERVER-SPECIFIC CODE fetch(`https://tlepeopledir.mit.edu/q/${petrockUserInfo.sub}`).then((x) => x.json()).then(directoryResponse => { - if (directoryResponse.result[0] !== undefined && directoryResponse.result[0].student_year === 1) { + if (directoryResponse.result[0] !== undefined && directoryResponse.result[0].student_year === '1') { fetch( `https://discord.com/api/v10/guilds/1186456227425828926/members/${discordUserInfo.id}/roles/1186460225943912539`, {