diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ef4cb3..f8f16d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [master] +## [0.0.27] - 2018-03-12 +### Added +- add 'quota' property to 'Mailbox' #74 + +## [0.0.26] - 2018-03-08 +### Added +- add properties 'MDNSent' and 'MDNNotSent' to 'SetResponse' for read receipt notifications #72 + +### Changed +- main entry point is now located in dist folder. + ## [0.0.25] - 2017-10-10 ### Added - Add 'namespace' and 'sharedWith' property to Mailbox. Fixes #69 diff --git a/lib/models/Mailbox.js b/lib/models/Mailbox.js index 5ee8861..dedf5a0 100644 --- a/lib/models/Mailbox.js +++ b/lib/models/Mailbox.js @@ -31,7 +31,9 @@ export default class Mailbox extends Model { * @param [opts.unreadMessages=0] {Number} The number of messages in this mailbox with _isUnread_=true and _isDraft_=false. * @param [opts.totalThreads=0] {Number} The number of threads where at least one message in the thread is in this mailbox. * @param [opts.unreadThreads=0] {Number} The number of threads where at least one message in the thread is in this mailbox with _isUnread_=true and _isDraft_=false. - * + * @param [opts.quotas={}] {Object} List of enforced quotas. 'STORAGE' for size quota and 'MESSAGE' for messages count. Each one provide used and max properties. + used (Number) number of messages, or size in bytes for storage + max (Number|null) maximum number of messages, or maximum size in bytes for storage. Null means unlimited * @see Model */ constructor(jmap, id, name, opts) { @@ -60,6 +62,7 @@ export default class Mailbox extends Model { this.unreadMessages = opts.unreadMessages || 0; this.totalThreads = opts.totalThreads || 0; this.unreadThreads = opts.unreadThreads || 0; + this.quotas = opts.quotas || {}; } /** diff --git a/test/common/models/Mailbox.js b/test/common/models/Mailbox.js index 4667fc8..68d1bde 100644 --- a/test/common/models/Mailbox.js +++ b/test/common/models/Mailbox.js @@ -38,6 +38,7 @@ describe('The Mailbox class', function() { expect(mailbox.unreadMessages).to.equal(0); expect(mailbox.totalThreads).to.equal(0); expect(mailbox.unreadThreads).to.equal(0); + expect(mailbox.quotas).to.deep.equal({}); }); it('should use default values for all other fields if an empty opts object is given', function() { @@ -59,6 +60,7 @@ describe('The Mailbox class', function() { expect(mailbox.unreadMessages).to.equal(0); expect(mailbox.totalThreads).to.equal(0); expect(mailbox.unreadThreads).to.equal(0); + expect(mailbox.quotas).to.deep.equal({}); }); it('should allow defining optional properties through the opts object', function() { @@ -144,6 +146,7 @@ describe('The Mailbox class', function() { expect(mailbox.unreadMessages).to.equal(0); expect(mailbox.totalThreads).to.equal(0); expect(mailbox.unreadThreads).to.equal(0); + expect(mailbox.quotas).to.deep.equal({}); }); it('should copy values for id, name, and all other fields if defined', function() { @@ -167,7 +170,8 @@ describe('The Mailbox class', function() { totalMessages: 123, unreadMessages: 4, totalThreads: 567, - unreadThreads: 8 + unreadThreads: 8, + quotas: { '#private&user': { STORAGE: { used: 10, max: 512 }, MESSAGE: { used: 42, max: null } } } }); expect(mailbox.id).to.equal('id'); @@ -188,6 +192,7 @@ describe('The Mailbox class', function() { expect(mailbox.unreadMessages).to.equal(4); expect(mailbox.totalThreads).to.equal(567); expect(mailbox.unreadThreads).to.equal(8); + expect(mailbox.quotas).to.deep.equal({ '#private&user': { STORAGE: { used: 10, max: 512 }, MESSAGE: { used: 42, max: null } } }); }); });