diff --git a/app/ui/client/views/app/directory.html b/app/ui/client/views/app/directory.html
index f2990d38bf8d..a9c729f6b159 100644
--- a/app/ui/client/views/app/directory.html
+++ b/app/ui/client/views/app/directory.html
@@ -45,8 +45,8 @@
{{_ "Users"}} {{> icon icon=(sortIcon 'usersCount')}}
{{#if showLastMessage}}
-
- {{_ "Last_Message"}}
+ |
+ {{_ "Last_Message"}} {{> icon icon=(sortIcon 'lastMessage')}}
|
{{/if}}
diff --git a/server/methods/browseChannels.js b/server/methods/browseChannels.js
index 0bb2e41362de..a0b61baad54c 100644
--- a/server/methods/browseChannels.js
+++ b/server/methods/browseChannels.js
@@ -15,6 +15,10 @@ const sortChannels = function(field, direction) {
return {
ts: direction === 'asc' ? 1 : -1,
};
+ case 'lastMessage':
+ return {
+ 'lastMessage.ts': direction === 'asc' ? 1 : -1,
+ };
default:
return {
[field]: direction === 'asc' ? 1 : -1,
@@ -51,7 +55,7 @@ Meteor.methods({
return;
}
- if (!['name', 'createdAt', 'usersCount', ...type === 'channels' ? ['usernames'] : [], ...type === 'users' ? ['username', 'email'] : []].includes(sortBy)) {
+ if (!['name', 'createdAt', 'usersCount', ...type === 'channels' ? ['usernames', 'lastMessage'] : [], ...type === 'users' ? ['username', 'email'] : []].includes(sortBy)) {
return;
}
|