Expand description
Claiming the right to mail a Sisu person an account-linking link, and minting the token it carries. Both caps and the dedup guard are evaluated here and nowhere else, and no argument switches them off; an override has to soft-delete a ledger row.
The token is minted bound to no account: the recipient’s Sisu address is routinely not the address on their account here, so the click while logged in is what creates the binding.
Structs§
- Discovered
Person - One person Sisu’s
list-by-coursereturned, and the address we mail them at. - Retired
Mails - What
retire_capped_mailsdid.
Enums§
- Linking
Mail Claim - What claiming a linking mail did for one person. Ordered from weakest to strongest, so the strongest of several claims for one person is their maximum.
Constants§
- JUST_
CLAIMED_ PERIOD - No override retires a mail claimed this recently, so a second click, tab or colleague cannot replace one that has only just gone out.
- LINKING_
MAIL_ QUIET_ PERIOD - How long after a linking mail the person is left alone, across every course and address.
- LINKING_
MAIL_ RESEND_ INTERVAL - How long after a linking mail for a course the same person may get another for it.
- LINK_
STUDENT_ NUMBER_ PATH - Both the mailed URL and the frontend route that serves it are built from this one value.
- MAX_
LINKING_ MAILS_ PER_ PERSON_ AND_ COURSE - How many linking mails one person may ever get for one course, tokens that expired unused included.
Functions§
- claim_
linking_ mail - One person’s
claim_linking_mails_batch. - claim_
linking_ mails_ batch - Claims one slot and one unbound token per person whose address has no usable link from us yet, dedup before the rate caps. Returns one claim per input, in order.
- holds_
address 🔒 - Whether a mail to this (person, course, address) still holds the address. The unique index
behind
claim_send_slotsis what actually prevents a second one. - is_
within_ 🔒caps - Whether the caps still allow this person another mail for this course.
- link_
student_ number_ url - The link the mail carries: a bearer credential, whoever holds it can claim the student number.
- listed_
addresses - The person’s non-empty Sisu addresses, trimmed, primary first.
- mail_
address - The address a linking mail to
persongoes to, if Sisu holds one: the primary, else the secondary. - person_
id_ 🔒of_ mails - registerable_
completion_ courses_ by_ account_ email - For each of the lowercased
addressesthat is the account email of someone with a completion the push path will register (credit_registration_eligible_completions, prerequisites met and not held for review) on one ofcourse_idscreated at or aftersince, the courses it is on. - retire_
capped_ mails - Retires the linking-mail rows the caps are counting for this person, so the ordinary claim path can take a slot again. No parameter relaxes a cap: the single writer of the ledger evaluates them from the rows that exist, so getting past one means soft-deleting rows, audited as its own action.
- void_
tokens 🔒 - Soft-deletes tokens whose slot lost the race, so no unusable link is left behind.