From f46a820ad83684894dfc32a89531d6d29552a227 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 9 Jul 2021 11:41:08 +0200 Subject: [PATCH] Don't sort 'sorted lists' in forms by default --- www/form/inner.js | 5 ++++- www/form/main.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/www/form/inner.js b/www/form/inner.js index 2a1501ecb..f9427024f 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -1470,6 +1470,7 @@ define([ if (!Array.isArray(opts.values)) { return; } var map = {}; var invMap = {}; + var sorted = false; var els = opts.values.map(function (data, i) { var uid = Util.uid(); map[uid] = data; @@ -1479,7 +1480,7 @@ define([ h('i.fa.fa-ellipsis-v'), h('i.fa.fa-ellipsis-v'), ]), - h('span.cp-form-sort-order', (i+1)), + h('span.cp-form-sort-order', '?'), h('span', data) ]); $(div).data('val', data); @@ -1494,6 +1495,7 @@ define([ $tag.find('.cp-form-type-sort').each(function (i, el) { $(el).find('.cp-form-sort-order').text(i+1); }); + sorted = true; }; var cursorGetter; var setCursorGetter = function (f) { cursorGetter = f; }; @@ -1516,6 +1518,7 @@ define([ return { tag: tag, getValue: function () { + if (!sorted) { return; } return sortable.toArray().map(function (id) { return map[id]; }); diff --git a/www/form/main.js b/www/form/main.js index 9ccac3d00..112b548db 100644 --- a/www/form/main.js +++ b/www/form/main.js @@ -265,6 +265,7 @@ define([ }, function (obj) { if (obj && obj.error) { return void cb(obj); } var messages = obj.messages; + if (!messages.length) { return void cb(); } var res = Utils.Crypto.Mailbox.openOwnSecretLetter(messages[0].msg, { validateKey: data.validateKey, ephemeral_private: Nacl.util.decodeBase64(answer.curvePrivate),