From 41f8da2e7ce1881766e8d27a9694e5707acf1e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 2 Oct 2019 18:18:51 -0400 Subject: [PATCH] fix: fix the order of groups on user profile --- src/controllers/accounts/profile.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/controllers/accounts/profile.js b/src/controllers/accounts/profile.js index 5c004e243b..edfd085cdc 100644 --- a/src/controllers/accounts/profile.js +++ b/src/controllers/accounts/profile.js @@ -58,9 +58,8 @@ profileController.get = async function (req, res, next) { addMetaTags(res, userData); - userData.selectedGroup = userData.groups.filter(function (group) { - return group && userData.groupTitleArray.includes(group.name); - }); + userData.selectedGroup = userData.groups.filter(group => group && userData.groupTitleArray.includes(group.name)) + .sort((a, b) => userData.groupTitleArray.indexOf(a.name) - userData.groupTitleArray.indexOf(b.name)); const results = await plugins.fireHook('filter:user.account', { userData: userData, uid: req.uid }); res.render('account/profile', results.userData);