From eec496c253fd7c6b30d6baf6151b141e3eaffe0e Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 5 Mar 2022 21:01:06 +0100 Subject: [PATCH] Make quiz "responses" write only when validated --- api/src/api/me.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/api/me.js b/api/src/api/me.js index 765474a..dc27af7 100644 --- a/api/src/api/me.js +++ b/api/src/api/me.js @@ -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 })