When adding and removing oneself from course instances, client locally updates me.courseInstances

This commit is contained in:
Scott Erickson 2015-12-03 16:32:37 -08:00
parent 89aeac9424
commit 3f31c9b4dd

View file

@ -22,6 +22,7 @@ module.exports = class CourseInstance extends CocoModel
}
_.extend options, opts
@fetch(options)
me.get('courseInstances').push(@id) if userID is me.id
removeMember: (userID, opts) ->
options = {
@ -31,6 +32,7 @@ module.exports = class CourseInstance extends CocoModel
}
_.extend options, opts
@fetch(options)
me.set('courseInstances', _.without(me.get('courseInstances'), @id)) if userID is me.id
firstLevelURL: ->
"/play/level/dungeons-of-kithgard?course=#{@get('courseID')}&course-instance=#{@id}"