Newest messages first when listing msgs from Gopher

This commit is contained in:
Bryan Ashby 2018-11-21 17:55:31 -07:00
parent 3af5b6f509
commit ebc70907d4
2 changed files with 22 additions and 9 deletions

View file

@ -353,13 +353,19 @@ function getNewMessagesInAreaForUser(userId, areaTag, cb) {
});
}
function getMessageListForArea(client, areaTag, cb) {
const filter = {
areaTag,
resultType : 'messageList',
sort : 'messageId',
order : 'ascending',
};
function getMessageListForArea(client, areaTag, filter, cb)
{
if(!cb && _.isFunction(filter)) {
cb = filter;
filter = {
areaTag,
resultType : 'messageList',
sort : 'messageId',
order : 'ascending'
};
} else {
Object.assign(filter, { areaTag } );
}
if(Message.isPrivateAreaTag(areaTag)) {
filter.privateTagUserId = client.user.userId;