Skip to content

Hand an erased teacher's classes to a co-teacher, or delete them - #64

Merged
Mistium merged 1 commit into
mainfrom
classroom-teacher-erase
Oct 24, 2026
Merged

Mistium merged 1 commit into
mainfrom
classroom-teacher-erase

Conversation

@Mistium

@Mistium Mistium commented Oct 24, 2026

Copy link
Copy Markdown
Member

When a teacher's account was erased, by Rotur's webhook or by them deleting their MistWarp account, eraseUser left their classes and students behind. Only admin purge cleaned them up.

Now eraseUser starts by handing over the teacher's Classroom data:

  • Classes they owned with a co-teacher: the first co-teacher becomes the owner, gets a "You are now the owner of …" notification, and the class audit log records the transfer. The new owner's seat limits aren't checked, so no student is deleted just because their plan is full.
  • Classes they owned with no co-teacher: the class is deleted with its students, groups, presentations, release links, assignments and submissions, the same way admin purge and the retention sweep delete a class.
  • Classes they co-taught: they leave them.
  • Their school: they leave it. If they were its last admin, the first remaining teacher becomes admin so the school can still be managed.

This runs whether or not CLASSROOM_ENABLED is on, since it's cleanup. A Stripe subscription the teacher had isn't touched; it stays with Stripe until cancelled there.

The decisions live in two pure functions in classroom-policy.osl, classAfterTeacherErased and schoolAfterTeacherErased, with tests in classroom-policy.test.osl. osl test passes (44/44), the touched files have no warnings, and the API compiles.

No visible change.

When a teacher's account is erased (by Rotur's webhook or by deleting
their own account), each class they owned passes to its first
co-teacher. A class with no co-teacher is deleted with its students,
as admin purge does. They also leave every class they co-taught and
their school, and a school losing its last admin promotes its first
remaining teacher.
@Mistium
Mistium merged commit 52b08cd into main Oct 24, 2026
@Mistium Mistium mentioned this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant