[NEW] Sort the Omnichannel Chat list according to the user preferences (#16437)

* Fix the order of the Omnichannel chats list, keeping the items sorted by activity.

* Remove invalid console.log.

* Sort the Omnichannel chat list according the user preference.

* Remove unnecessary extra parenthesis.
pull/16450/head
Renato Becker 6 years ago committed by GitHub
parent 90aea1f043
commit 38fc6ec154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      app/livechat/client/views/sideNav/livechat.js

@ -37,20 +37,16 @@ Template.livechat.helpers({
open: true,
};
const user = Users.findOne(Meteor.userId(), {
fields: { 'settings.preferences.sidebarShowUnread': 1 },
});
const user = Meteor.userId();
if (getUserPreference(user, 'sidebarShowUnread')) {
query.alert = { $ne: true };
}
return ChatSubscription.find(query, {
sort: {
t: 1,
fname: 1,
},
});
const sortBy = getUserPreference(user, 'sidebarSortby');
const sort = sortBy === 'activity' ? { _updatedAt: - 1 } : { fname: 1 };
return ChatSubscription.find(query, { sort });
},
inquiries() {

Loading…
Cancel
Save