1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 10:52:17 -05:00

Merge pull request #157 from whiteout-io/dev/WO-660

[WO-660] Add \Flagged to message flags
This commit is contained in:
Tankred Hase 2014-11-06 16:13:54 +01:00
commit 8cc84ef8c6
9 changed files with 24 additions and 15 deletions

View File

@ -37,7 +37,7 @@
"axe-logger": "~0.0.2", "axe-logger": "~0.0.2",
"crypto-lib": "~0.2.1", "crypto-lib": "~0.2.1",
"dompurify": "~0.4.2", "dompurify": "~0.4.2",
"imap-client": "~0.5.0", "imap-client": "~0.6.0",
"jquery": "~2.1.1", "jquery": "~2.1.1",
"mailreader": "~0.4.0", "mailreader": "~0.4.0",
"ng-infinite-scroll": "~1.1.2", "ng-infinite-scroll": "~1.1.2",
@ -48,7 +48,7 @@
"angularjs": "https://github.com/whiteout-io/angular.js/tarball/npm-version", "angularjs": "https://github.com/whiteout-io/angular.js/tarball/npm-version",
"browsercrow": "https://github.com/whiteout-io/browsercrow/tarball/master", "browsercrow": "https://github.com/whiteout-io/browsercrow/tarball/master",
"browsersmtp": "https://github.com/whiteout-io/browsersmtp/tarball/master", "browsersmtp": "https://github.com/whiteout-io/browsersmtp/tarball/master",
"chai": "~1.7.2", "chai": "~1.9.2",
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-browserify": "^3.0.1", "grunt-browserify": "^3.0.1",
"grunt-contrib-clean": "~0.5.0", "grunt-contrib-clean": "~0.5.0",

View File

@ -545,7 +545,8 @@ EmailDAO.prototype.setFlags = function(options, callback) {
folder: folder, folder: folder,
uid: options.message.uid, uid: options.message.uid,
unread: options.message.unread, unread: options.message.unread,
answered: options.message.answered answered: options.message.answered,
flagged: options.message.flagged
}, function(err) { }, function(err) {
if (err) { if (err) {
done(err); done(err);
@ -572,6 +573,7 @@ EmailDAO.prototype.setFlags = function(options, callback) {
// set the flags // set the flags
var storedMessage = storedMessages[0]; var storedMessage = storedMessages[0];
storedMessage.unread = options.message.unread; storedMessage.unread = options.message.unread;
storedMessage.flagged = options.message.flagged;
storedMessage.answered = options.message.answered; storedMessage.answered = options.message.answered;
storedMessage.modseq = options.message.modseq || storedMessage.modseq; storedMessage.modseq = options.message.modseq || storedMessage.modseq;

View File

@ -14,7 +14,7 @@ var ImapClient = require('imap-client'),
describe('Email DAO integration tests', function() { describe('Email DAO integration tests', function() {
this.timeout(100000); this.timeout(100000);
chai.Assertion.includeStack = true; chai.config.includeStack = true;
var emailDao, imapClient, imapMessages, imapFolders, imapServer, smtpServer, smtpClient, userStorage, var emailDao, imapClient, imapMessages, imapFolders, imapServer, smtpServer, smtpClient, userStorage,
mockKeyPair, inbox, spam; mockKeyPair, inbox, spam;
@ -321,11 +321,13 @@ describe('Email DAO integration tests', function() {
it('should receive new messages', function(done) { it('should receive new messages', function(done) {
emailDao.onIncomingMessage = function(messages) { emailDao.onIncomingMessage = function(messages) {
expect(messages.length).to.equal(1); expect(messages.length).to.equal(1);
expect(messages[0].answered).to.be.false; expect(messages[0].answered).to.be.true;
expect(messages[0].flagged).to.be.true;
expect(messages[0].unread).to.be.false;
done(); done();
}; };
imapServer.appendMessage('INBOX', ['$My$Flag'], false, 'Message-id: <n1>\r\nSubject: new message\r\n\r\nhello world!'); imapServer.appendMessage('INBOX', ['\\Flagged', '\\Seen', '\\Answered'], false, 'Message-id: <n1>\r\nSubject: new message\r\n\r\nhello world!');
}); });
it('should delete a message', function(done) { it('should delete a message', function(done) {
@ -391,6 +393,7 @@ describe('Email DAO integration tests', function() {
var message = inbox.messages[1]; var message = inbox.messages[1];
message.unread = false; message.unread = false;
message.answered = true; message.answered = true;
message.flagged = true;
emailDao.setFlags({ emailDao.setFlags({
folder: inbox, folder: inbox,

View File

@ -48,3 +48,6 @@ if (!Function.prototype.bind) {
// set worker path for tests // set worker path for tests
require('../src/js/app-config').config.workerPath = '../lib'; require('../src/js/app-config').config.workerPath = '../lib';
var axe = require('axe-logger');
axe.removeAppender(axe.defaultAppender);

View File

@ -3,7 +3,7 @@
var btnHandler = require('../../src/js/util/backbutton-handler'); var btnHandler = require('../../src/js/util/backbutton-handler');
describe('Backbutton Handler', function() { describe('Backbutton Handler', function() {
chai.Assertion.includeStack = true; chai.config.includeStack = true;
var scope, event; var scope, event;

View File

@ -13,7 +13,7 @@ var mailreader = require('mailreader'),
describe('Email DAO unit tests', function() { describe('Email DAO unit tests', function() {
// show the stack trace when an error occurred // show the stack trace when an error occurred
chai.Assertion.includeStack = true; chai.config.includeStack = true;
// SUT // SUT
var dao; var dao;
@ -717,7 +717,8 @@ describe('Email DAO unit tests', function() {
folder: inboxFolder, folder: inboxFolder,
uid: message.uid, uid: message.uid,
unread: message.unread, unread: message.unread,
answered: message.answered answered: message.answered,
flagged: message.flagged
}).yieldsAsync(); }).yieldsAsync();
localListStub.withArgs({ localListStub.withArgs({

View File

@ -8,7 +8,7 @@ var mocks = angular.mock,
appController = require('../../src/js/app-controller'), appController = require('../../src/js/app-controller'),
notification = require('../../src/js/util/notification'); notification = require('../../src/js/util/notification');
chai.Assertion.includeStack = true; chai.config.includeStack = true;
describe('Mail List controller unit test', function() { describe('Mail List controller unit test', function() {
var scope, ctrl, origEmailDao, emailDaoMock, keychainMock, deviceStorageMock, var scope, ctrl, origEmailDao, emailDaoMock, keychainMock, deviceStorageMock,

View File

@ -5,12 +5,12 @@ var OutboxBO = require('../../src/js/bo/outbox'),
EmailDAO = require('../../src/js/dao/email-dao'), EmailDAO = require('../../src/js/dao/email-dao'),
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'); DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
chai.Assertion.includeStack = true;
describe('Outbox Business Object unit test', function() { describe('Outbox Business Object unit test', function() {
var outbox, emailDaoStub, devicestorageStub, keychainStub, var outbox, emailDaoStub, devicestorageStub, keychainStub,
dummyUser = 'spiderpig@springfield.com'; dummyUser = 'spiderpig@springfield.com';
chai.config.includeStack = true;
beforeEach(function() { beforeEach(function() {
emailDaoStub = sinon.createStubInstance(EmailDAO); emailDaoStub = sinon.createStubInstance(EmailDAO);
emailDaoStub._account = { emailDaoStub._account = {

View File

@ -9,7 +9,7 @@ var DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'),
describe('UpdateHandler', function() { describe('UpdateHandler', function() {
var updateHandler, appConfigStorageStub, authStub, userStorageStub, origDbVersion; var updateHandler, appConfigStorageStub, authStub, userStorageStub, origDbVersion;
chai.Assertion.includeStack = true; chai.config.includeStack = true;
beforeEach(function() { beforeEach(function() {
origDbVersion = cfg.dbVersion; origDbVersion = cfg.dbVersion;