From 1060bf9766600241ee12734ff4f7bb833aaa9edc Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Thu, 12 Dec 2024 13:38:44 +0100 Subject: [PATCH] feat: Filter posting rights on user name Refs: #RW-1058 --- .../reliefweb-user-posting-rights.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js index a3b02336c..2ff544c28 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js @@ -106,8 +106,9 @@ option.setAttribute('selected', ''); select.appendChild(option); - // List content in reverse order (most recently added first). - for (var i = data.length - 1; i >= 0; i--) { + // List alphabetically. + data = data.sort((a, b) => a.name.localeCompare(b.name)); + for (var i = 0; i < data.length; i++) { var option = document.createElement('option'); option.appendChild(document.createTextNode(data[i].name)); option.setAttribute('value', data[i].name);