Skip to content

Commit

Permalink
fix: force lowercase emails
Browse files Browse the repository at this point in the history
  • Loading branch information
rutmanz committed Aug 30, 2024
1 parent dfa4893 commit 12f3e5f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function loadNext() {
const email = person.querySelector('a')?.innerHTML?.trim()
const photo = person.querySelector('.directory-Entry_PersonPhoto--full')?.src
if (email && photo) {
data[email] = photo.replace("c_limit", "c_fill,g_north")
data[email] = photo.replace('c_limit', 'c_fill,g_north')
} else {
console.log('missing data for', person)
}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ router
})
.post(async (c) => {
const data = (await c.req.json()) as Partial<Member>
const email = data.email?.trim()
const email = data.email?.trim()?.toLowerCase()
const full_name = data.full_name?.trim()
if (email == null || full_name == null) {
return c.json({ success: false })
Expand Down
2 changes: 1 addition & 1 deletion src/slack/blocks/app_home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function getAppHome(user_id: string) {
if (config.slack.users.admins.includes(user_id)) {
const pending_requests = await getPendingHourSubmissionData()
const pending_certs = await prisma.memberCertRequest.findMany({ where: { state: 'pending' }, include: { Member: true, Cert: true, Requester: true } })

homeTab.blocks(Blocks.Header().text('Pending Hour Submissions'))
if (pending_requests.length > 0) {
homeTab.blocks(pending_requests.flatMap((req) => [...getHourSubmissionBlocks(req), Blocks.Divider()]))
Expand Down
2 changes: 1 addition & 1 deletion src/slack/handlers/views/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const handleSubmitOnboardingModal: ViewMiddleware = async ({ ack, view })
const fallback_photo_map = new Map<string, string>(fallback_photos.map((fp) => [fp.email, fp.url]))
await prisma.member.createMany({
data: members_to_add.map((m) => ({
email: m.profile!.email!,
email: m.profile!.email!.trim().toLowerCase(),
slack_id: m.id,
slack_photo: m.profile?.image_original,
slack_photo_small: m.profile?.image_192,
Expand Down
6 changes: 3 additions & 3 deletions src/tasks/certs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export async function announceNewCerts() {

export async function updateProfileCerts() {
const members = await prisma.member.findMany({
where: { slack_id: {not: null} },
where: { slack_id: { not: null } },
select: {
slack_id: true,
MemberCerts: {
select: { Cert: { select: { label: true } } }
select: { Cert: { select: { label: true } } }
}
}
})
Expand All @@ -81,4 +81,4 @@ export async function updateProfileCerts() {
)
}
}
}
}
4 changes: 2 additions & 2 deletions src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export function scheduleTasks() {
tasks['Sync Sheet'] = scheduleTask(updateSheet, 60 * 30, isProd, 0) // Update spreadsheet every half-hour
tasks['Sync Members'] = scheduleTask(syncSlackMembers, 60 * 60, isProd, 0) // Update slack members every hour, can also be run manually on admin dashboard
tasks['Announce Certs'] = scheduleTask(announceNewCerts, 60 * 60, isProd, 60) // Just in case the cert announcement isn't automatically run on changes
tasks['Sync Usergroups'] = scheduleTask(updateSlackUsergroups, 60 * 60, isProd, 2*60)
tasks['Update Profile Certs'] = scheduleTask(updateProfileCerts, 60*60*24, isProd, 5*60)
tasks['Sync Usergroups'] = scheduleTask(updateSlackUsergroups, 60 * 60, isProd, 2 * 60)
tasks['Update Profile Certs'] = scheduleTask(updateProfileCerts, 60 * 60 * 24, isProd, 5 * 60)
}

export async function runTask(key: string) {
Expand Down

0 comments on commit 12f3e5f

Please sign in to comment.