Make quiz "responses" write only when validated

This commit is contained in:
Niko 2022-03-05 21:01:06 +01:00
parent 8d2416f3c5
commit eec496c253
1 changed files with 1 additions and 1 deletions

View File

@ -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 })