diff --git a/packages/rocketchat-ui-flextab/client/tabs/membersList.js b/packages/rocketchat-ui-flextab/client/tabs/membersList.js index c9e35fcd0a92..f6a92be62667 100644 --- a/packages/rocketchat-ui-flextab/client/tabs/membersList.js +++ b/packages/rocketchat-ui-flextab/client/tabs/membersList.js @@ -53,7 +53,11 @@ Template.membersList.helpers({ }; }); - users = _.sortBy(users, u => u.user.username); + if (RocketChat.settings.get('UI_Use_Real_Name')) { + users = _.sortBy(users, u => u.user.name); + } else { + users = _.sortBy(users, u => u.user.username); + } // show online users first. // sortBy is stable, so we can do this users = _.sortBy(users, u => u.status == null); diff --git a/packages/rocketchat-ui-sidenav/client/directMessages.js b/packages/rocketchat-ui-sidenav/client/directMessages.js index ae73370b526f..68e09b80d82e 100644 --- a/packages/rocketchat-ui-sidenav/client/directMessages.js +++ b/packages/rocketchat-ui-sidenav/client/directMessages.js @@ -7,6 +7,7 @@ Template.directMessages.helpers({ rooms() { const query = { t: { $in: ['d']}, f: { $ne: true }, open: true }; + const sort = { 't': 1 }; if (Meteor.user() && Meteor.user().settings && Meteor.user().settings.preferences && Meteor.user().settings.preferences.unreadRoomsMode) { query.$or = [ @@ -15,6 +16,11 @@ Template.directMessages.helpers({ ]; } - return ChatSubscription.find(query, { sort: { 't': 1, 'name': 1 }}); + if (RocketChat.settings.get('UI_Use_Real_Name')) { + sort.fname = 1; + } + sort.name = 1; + + return ChatSubscription.find(query, { sort }); } });