Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!group.hasOwnProperty('receiveAnswer') || !group.receiveAnswer ){
logger.warn("Invalid answer submission - currently not taking answers");
return;
}
// Clean data
answer = cleanAnswer(answer, group.question);
// Verify qID
if (group.question.qID != qID) {
logger.info("Answer submitted for wrong qID");
return;
}
// Send Answer to Admin
var presenter = nowjs.users[group.presenter];
presenter.now.receiveAnswer(that.user.clientId, name, answer);
// Save Answer to DB
SSM.saveAnswer(answer, group.question, name)
// Send Answer to plugins
/**
* Hook fired when a answer is received.
*
* @event distribute
* @for plugin-server.answer
* @param {String} room The room that the question was distributed to
* @param {String} clientID The client's id who submitted the answer
* @param {String} name The client's name who submitted the answer
* @param {Object} question An object with all the question information
* @param {String} answer The answer submitted by the client
sessionAPI.getSession(that, sessionStore, function(err, session) {
var room = session.room
, nowName = nowjs.users[that.user.clientId].now.name
, hasSessionName = session.hasOwnProperty('user') && session.user.hasOwnProperty('name')
, name = hasSessionName ? session.user.name : nowName
, group = nowjs.getGroup(room)
, answer = data.answer
, qID = data.qID;
log('Answer Sent ' + name + '\n [' + that.user.clientId + ']', util.inspect(data));
// If we had any errors, exit here
if (err) {
logger.error("Error retrieving session for nowjs connection [distributeAnswer]: " + err.message);
return;
}
// Ensure that answer are allowed to be received
if (!group.hasOwnProperty('receiveAnswer') || !group.receiveAnswer ){