fix: allow teacher-parents to enroll their children in other classrooms
Remove `!isTeacher` check from enterClassroom, leaveClassroom, and enrollInClassroom actions. The `isMyChild` check is sufficient to ensure these parent-specific actions only appear for the user's own children, not for other students in their classroom roster. This fixes the case where a parent who is also a teacher couldn't enroll their own child in another teacher's classroom. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -70,12 +70,15 @@ export function getAvailableActions(
|
||||
// Primary actions
|
||||
startPractice: true, // Always available
|
||||
watchSession: isPracticing && hasSessionId,
|
||||
enterClassroom: !isTeacher && !!hasEnrolledClassrooms && !isPresent,
|
||||
leaveClassroom: !isTeacher && isPresent,
|
||||
// Parents can enter/leave their own children (even if they're also teachers)
|
||||
enterClassroom: isMyChild && !!hasEnrolledClassrooms && !isPresent,
|
||||
leaveClassroom: isMyChild && isPresent,
|
||||
// Teachers can remove students from their classroom
|
||||
removeFromClassroom: isTeacher && isPresent,
|
||||
|
||||
// Enrollment actions
|
||||
enrollInClassroom: !isTeacher && isMyChild && !isEnrolled,
|
||||
// Parents can enroll their children (even if they're also teachers)
|
||||
enrollInClassroom: isMyChild && !isEnrolled,
|
||||
unenrollStudent: isTeacher && isEnrolled,
|
||||
|
||||
// Management actions
|
||||
|
||||
Reference in New Issue
Block a user