From 20daa1ce137f166fba83e1a89b76573f3ac04e2f Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 26 Feb 2024 19:34:50 +0100 Subject: [PATCH] Sort S/MIME certificates on emailAddress else validTo --- dev/Stores/User/SMime.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/Stores/User/SMime.js b/dev/Stores/User/SMime.js index f5f5dd312..70fa2043c 100644 --- a/dev/Stores/User/SMime.js +++ b/dev/Stores/User/SMime.js @@ -12,6 +12,9 @@ SMimeUserStore.loadCertificates = () => { SMimeUserStore.loading(true); Remote.request('SMimeGetCertificates', (iError, oData) => { SMimeUserStore.loading(false); - iError || SMimeUserStore(oData.Result); + const collator = new Intl.Collator(undefined, {sensitivity: 'base'}); + iError || SMimeUserStore(oData.Result.sort( + (a, b) => collator.compare(a.emailAddress, b.emailAddress) || (b.validTo_time_t - a.validTo_time_t) + )); }); };