From c389ea6f76e306a3280a9e3533bf39cdf75a1d99 Mon Sep 17 00:00:00 2001 From: Nikolai Ovtsinnikov Date: Mon, 23 Oct 2023 11:11:21 +0300 Subject: [PATCH] fix createAsync wrapper, strict ordering. Settings handler remove unnecessary second param --- lib/mailbox-handler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mailbox-handler.js b/lib/mailbox-handler.js index 48cb7d00..641b2c41 100644 --- a/lib/mailbox-handler.js +++ b/lib/mailbox-handler.js @@ -26,7 +26,7 @@ class MailboxHandler { create(user, path, opts, callback) { this.createAsync(user, path, opts) - .then(mailboxData => callback(null, ...Object.values(mailboxData))) + .then(mailboxData => callback(null, ...[mailboxData.status, mailboxData.id])) .catch(err => callback(err)); } @@ -51,7 +51,7 @@ class MailboxHandler { const mailboxCountForUser = await this.database.collection('mailboxes').countDocuments({ user }); - if (mailboxCountForUser > (await this.settingsHandler.get('const:max:mailboxes', {}))) { + if (mailboxCountForUser > (await this.settingsHandler.get('const:max:mailboxes'))) { const err = new Error('Mailbox creation failed with code ReachedMailboxCountLimit. Max mailboxes count reached.'); err.code = 'CANNOT'; err.responseCode = 400;