mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-02 16:21:01 -04:00
Fix removing members from classrooms and course instances
This commit is contained in:
parent
3c1a55fc2f
commit
4403347290
2 changed files with 2 additions and 2 deletions
server
|
@ -79,7 +79,7 @@ ClassroomHandler = class ClassroomHandler extends Handler
|
|||
alreadyNotInClassroom = not _.any classroom.get('members') or [], (memberID) -> memberID.toString() is userID
|
||||
return @sendSuccess(res, @formatEntity(req, classroom)) if alreadyNotInClassroom
|
||||
members = _.clone(classroom.get('members'))
|
||||
members.splice(members.indexOf(userID), 1)
|
||||
members = (m for m in members when m.toString() isnt userID)
|
||||
classroom.set('members', members)
|
||||
classroom.save (err, classroom) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
|
|
|
@ -111,7 +111,7 @@ CourseInstanceHandler = class CourseInstanceHandler extends Handler
|
|||
alreadyNotInCourseInstance = not _.any courseInstance.get('members') or [], (memberID) -> memberID.toString() is userID
|
||||
return @sendSuccess(res, @formatEntity(req, courseInstance)) if alreadyNotInCourseInstance
|
||||
members = _.clone(courseInstance.get('members'))
|
||||
members.splice(members.indexOf(userID), 1)
|
||||
members = (m for m in members when m.toString() isnt userID)
|
||||
courseInstance.set('members', members)
|
||||
courseInstance.save (err, courseInstance) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
|
|
Loading…
Add table
Reference in a new issue