Make quiz "responses" write only when validated
This commit is contained in:
parent
8d2416f3c5
commit
eec496c253
|
@ -195,10 +195,10 @@ module.exports = {
|
|||
if (responses.length !== quiz.content.length)
|
||||
return res.json({ error: 'invalid_params' })
|
||||
|
||||
await db.table.quizs().updateOne({ _id: quiz._id }, { $set: { responses } })
|
||||
html = quizResponseBuild(responses)
|
||||
if (html === false)
|
||||
return res.json({ error: 'invalid_params' })
|
||||
await db.table.quizs().updateOne({ _id: quiz._id }, { $set: { responses } })
|
||||
|
||||
await sendNote(apID(res.locals.user.username), quiz.from, html,
|
||||
function(o){ o.object.inReplyTo = quiz.replyTo; return o })
|
||||
|
|
Loading…
Reference in New Issue