This commit is contained in:
Barış Soner Uşaklı
2019-08-13 16:13:39 -04:00
parent 29f96b199c
commit 7162051905
3 changed files with 36 additions and 0 deletions

View File

@@ -38,9 +38,21 @@ editController.get = async function (req, res, next) {
if (!userData.allowMultipleBadges) {
userData.groupTitle = userData.groupTitleArray[0];
}
userData.groups.sort((a, b) => {
const i1 = userData.groupTitleArray.indexOf(a.name);
const i2 = userData.groupTitleArray.indexOf(b.name);
if (i1 === -1) {
return 1;
} else if (i2 === -1) {
return -1;
}
return i1 - i2;
});
userData.groups.forEach(function (group) {
group.selected = userData.groupTitleArray.includes(group.name);
});
userData.groupSelectSize = Math.min(10, Math.max(5, userData.groups.length + 1));
userData.title = '[[pages:account/edit, ' + userData.username + ']]';
userData.breadcrumbs = helpers.buildBreadcrumbs([