mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-12 08:41:46 -05:00
Merge hotfix for sending course invite emails
This commit is contained in:
commit
dd17c39708
2 changed files with 4 additions and 3 deletions
|
@ -124,7 +124,7 @@ module.exports = class Classroom extends CocoModel
|
|||
|
||||
inviteMembers: (emails, options={}) ->
|
||||
options.data ?= {}
|
||||
options.data.email = emails
|
||||
options.data.emails = emails
|
||||
options.url = @url() + '/invite-members'
|
||||
options.type = 'POST'
|
||||
@fetch(options)
|
||||
|
|
|
@ -221,14 +221,15 @@ module.exports =
|
|||
|
||||
inviteMembers: wrap (req, res) ->
|
||||
if not req.body.emails
|
||||
log.debug "classrooms.inviteMembers: No emails included in request: #{JSON.stringify(req.body)}"
|
||||
throw new errors.UnprocessableEntity('Emails not included')
|
||||
|
||||
classroom = yield database.getDocFromHandle(req, Classroom)
|
||||
if not classroom
|
||||
throw new errors.NotFound('Classroom not found.')
|
||||
|
||||
|
||||
unless classroom.get('ownerID').equals(req.user?._id)
|
||||
log.debug "classroom_handler.inviteStudents: Can't invite to classroom (#{classroom.id}) you (#{req.user.get('_id')}) don't own"
|
||||
log.debug "classroom_handler.inviteMembers: Can't invite to classroom (#{classroom.id}) you (#{req.user.get('_id')}) don't own"
|
||||
throw new errors.Forbidden('Must be owner of classroom to send invites.')
|
||||
|
||||
for email in req.body.emails
|
||||
|
|
Loading…
Reference in a new issue