Skip to content

Node.js based forum software built for the modern web

use array.find

barisusakli599ac80f3d6c
diff --git a/src/controllers/accounts/profile.js b/src/controllers/accounts/profile.js
index de10c69b6a..ee66a1a4d7 100644
--- a/src/controllers/accounts/profile.js
+++ b/src/controllers/accounts/profile.js
@@ -118,11 +118,8 @@ profileController.get = function(req, res, callback) {
}
);
}
-
- userData.groups.forEach(function(group) {
- if (group && group.name === userData.groupTitle) {
- userData.selectedGroup = group;
- }
+ userData.selectedGroup = userData.groups.find(function(group) {
+ return group && group.name === userData.groupTitle;
});
plugins.fireHook('filter:user.account', {userData: userData, uid: req.uid}, next);