From 669297db4cd3c04c2d1991b9fc0b7787726b44fa 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 7524cd57b..f1ad9d89d 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -2337,6 +2337,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); @@ -2392,6 +2396,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,