(email: string | null | undefined)
| 19 | * resolve to a known user id. |
| 20 | */ |
| 21 | export async function isEmailBlocked(email: string | null | undefined): Promise<boolean> { |
| 22 | if (!email) return false |
| 23 | const accessControl = await getAccessControlConfig() |
| 24 | if (isEmailBlockedByAccessControl(email, accessControl)) return true |
| 25 | const rows = await db |
| 26 | .select({ banned: user.banned, banExpires: user.banExpires }) |
| 27 | .from(user) |
| 28 | .where(sql`lower(${user.email}) = ${email.toLowerCase()}`) |
| 29 | return rows.some(isBanActive) |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Returns the subset of the given user ids that are currently blocked: an |
no test coverage detected