diff --git a/src/js/client.js b/src/js/client.js index 620d3b7e3..48bd1d98e 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -2148,6 +2148,15 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }; // Mailboxes + Client.prototype.getMailboxCount = function (domain, callback) { + get('/api/v1/mail/' + domain + '/mailbox_count', null, function (error, data, status) { + if (error) return callback(error); + if (status !== 200) return callback(new ClientError(status, data)); + + callback(null, data.count); + }); + }; + Client.prototype.getMailboxes = function (domain, search, page, perPage, callback) { var config = { params: { diff --git a/src/views/emails.js b/src/views/emails.js index 365120657..9b23d1418 100644 --- a/src/views/emails.js +++ b/src/views/emails.js @@ -136,10 +136,10 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati domain.outbound = mailConfig.relay.provider !== 'noop'; // do this even if no outbound since people forget to remove mailboxes - Client.getMailboxes(domain.domain, function (error, mailboxes) { + Client.getMailboxCount(domain.domain, function (error, count) { if (error) return console.error('Failed to fetch mailboxes for domain', domain.domain, error); - domain.mailboxCount = mailboxes.length; + domain.mailboxCount = count; Client.getMailUsage(domain.domain, function (error, usage) { if (error) return console.error('Failed to fetch usage for domain', domain.domain, error);