From 0ac34f1030971af15dc92f8be968fa2bc5a6069f Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 1 Sep 2021 12:11:52 +0200 Subject: [PATCH] Fix UI issues when editing responses is blocked in forms --- www/form/inner.js | 8 ++++++++ www/form/main.js | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/www/form/inner.js b/www/form/inner.js index f281d8452..ea2ebd100 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -2436,6 +2436,10 @@ define([ $cbox.after(h('div.alert.alert-info', Messages.form_authAnswer)); }); } + if (update && content.answers.cantEdit) { + $cbox.hide(); + anonName = undefined; + } var send = h('button.cp-open.btn.btn-primary', update ? Messages.form_update : Messages.form_submit); var reset = h('button.cp-open.cp-reset-button.btn.btn-danger-alt', Messages.form_reset); @@ -2491,6 +2495,10 @@ define([ $send.text(Messages.form_update); APP.hasAnswered = true; showAnsweredPage(framework, content, { '_time': +new Date() }); + if (content.answers.cantEdit) { + $cbox.hide(); + if ($anonName) { $anonName.hide(); } + } }); }); diff --git a/www/form/main.js b/www/form/main.js index 7d81b1268..8c794a19a 100644 --- a/www/form/main.js +++ b/www/form/main.js @@ -221,8 +221,7 @@ define([ delete results[parsed._proof.key]; } } - // XXX If "allow edition" is disabled, don't override here? - // if (data.cantEdit && results[senderCurve]) { return; } + if (data.cantEdit && results[senderCurve]) { return; } results[senderCurve] = { msg: parsed, hash: hash,