Skip to content

Ban · Modules

2 modules · 4 exports · 0 repositories · 7 e2e tests · 1 route

Who imports who · hover a node
Depends onBan modulesUsed byBanStatus2 exportsBans.server2 exportsRoutes1 fileLoaders1 fileActions3 filesRepositories1 fileLinkedRoles.serverdisco…TeamEligibility.serverVoiceJoin.servervoiceOther6 files

BanStatus

app/features/ban/core/BanStatus.ts

A site ban as User.banned stores it: 0 or null for none, 1 for a ban without an end, otherwise the database timestamp the ban lifts at. Lifting a timed ban doesn't touch the column, so whether a user is banned depends on the time it is asked at.

Imports
no other modules
Used by
1 route1 module

Functions & values

function

isActive

:11

Whether the ban of a User.banned value holds at now. A timed ban lifts at the second it ends.

export function isActive(
	banned: number | null | undefined,
	now: Date = new Date(),
): boolean
Unit tests (1)
function

endsAt

:22

When the ban of a User.banned value lifts, null for a ban without an end or no ban at all.

export function endsAt(banned: number | null | undefined): Date | null
Unit tests (2)

Bans

serverapp/features/ban/core/Bans.server.ts

Who is banned from the site, held in memory so every request can check its user without a query. Whatever writes User.banned (banning, unbanning, account migration) calls refresh after.

Imports
BanStatus
Used by
1 loader3 actions1 repository3 modules6 other

Functions & values

function

refresh

:16

Reloads the banned users from the database.

export async function refresh()
Unit tests (1)