mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-09-07 05:35:12 +08:00
fix(getmessages): ZMS-260: messages.js getMessages allow unseen request flag to be false (#861)
* messages.js allow unseen request flag to be false to allow search for seen messages only * messages.js check filterUnseen type instead of just checking for undefined
This commit is contained in:
parent
3d8db3834c
commit
aab6608119
1 changed files with 6 additions and 4 deletions
|
@ -321,7 +321,9 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
|
|||
mailbox: Joi.string().hex().lowercase().length(24).required().description('ID of the Mailbox')
|
||||
},
|
||||
queryParams: {
|
||||
unseen: booleanSchema.description('If true, then returns only unseen messages'),
|
||||
unseen: booleanSchema.description(
|
||||
'If true, then returns only unseen messages. If false, then returs only seen messages. Leave blank to return all messages'
|
||||
),
|
||||
metaData: booleanSchema.default(false).description('If true, then includes metaData in the response'),
|
||||
threadCounters: booleanSchema
|
||||
.default(false)
|
||||
|
@ -472,7 +474,7 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
|
|||
let pageNext = result.value.next;
|
||||
let pagePrevious = result.value.previous;
|
||||
let sortAscending = result.value.order === 'asc';
|
||||
let filterUnseen = result.value.unseen;
|
||||
const filterUnseen = result.value.unseen;
|
||||
|
||||
let includeHeaders = result.value.includeHeaders ? result.value.includeHeaders.split(',') : false;
|
||||
|
||||
|
@ -511,8 +513,8 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
|
|||
mailbox
|
||||
};
|
||||
|
||||
if (filterUnseen) {
|
||||
filter.unseen = true;
|
||||
if (typeof filterUnseen === 'boolean') {
|
||||
filter.unseen = filterUnseen;
|
||||
}
|
||||
|
||||
let total = await getFilteredMessageCount(filter);
|
||||
|
|
Loading…
Add table
Reference in a new issue