@@ -20,6 +20,7 @@ import { CourseActions } from "../actions";
20
20
import { CourseStore } from "../store" ;
21
21
import { UpgradeGoal } from "../types" ;
22
22
import { Result , run_in_all_projects } from "./run-in-all-projects" ;
23
+ import type { StudentRecord } from "../store" ;
23
24
24
25
// for tasks that are "easy" to run in parallel, e.g. starting projects
25
26
export const MAX_PARALLEL_TASKS = 30 ;
@@ -894,4 +895,31 @@ export class StudentProjectsActions {
894
895
await webapp_client . project_client . set_quotas ( x ) ;
895
896
}
896
897
} ;
898
+
899
+ removeFromAllStudentProjects = async ( student : StudentRecord ) => {
900
+ /*
901
+ - Remove student from their project
902
+ - Remove student from shared project
903
+ - TODO: Cancel any outstanding invite, in case they haven't even created their account yet.
904
+ This isn't even implemented yet as an api endpoint... but will cause confusion.
905
+ */
906
+ const shared_id = this . get_store ( ) ?. get_shared_project_id ( ) ;
907
+ const account_id = student . get ( "account_id" ) ;
908
+ const project_id = student . get ( "project_id" ) ;
909
+ if ( account_id ) {
910
+ if ( project_id ) {
911
+ // remove them from their project
912
+ await redux
913
+ . getActions ( "projects" )
914
+ . remove_collaborator ( project_id , account_id ) ;
915
+ }
916
+
917
+ if ( shared_id ) {
918
+ // remove them from shared project
919
+ await redux
920
+ . getActions ( "projects" )
921
+ . remove_collaborator ( shared_id , account_id ) ;
922
+ }
923
+ }
924
+ } ;
897
925
}
0 commit comments