diff --git a/packages/local-sync/src/local-sync-worker/sync-worker.es6 b/packages/local-sync/src/local-sync-worker/sync-worker.es6 index 3107b1d93..979ad1990 100644 --- a/packages/local-sync/src/local-sync-worker/sync-worker.es6 +++ b/packages/local-sync/src/local-sync-worker/sync-worker.es6 @@ -90,7 +90,6 @@ class SyncWorker { where: { folderId: null, isSent: {$not: true}, - isSending: {$not: true}, }, }) const noFolderImapUID = await Message.findAll({ diff --git a/packages/local-sync/src/local-sync-worker/syncback-tasks/send-message-per-recipient.smtp.js b/packages/local-sync/src/local-sync-worker/syncback-tasks/send-message-per-recipient.smtp.js index 6e2465be4..2c2835e41 100644 --- a/packages/local-sync/src/local-sync-worker/syncback-tasks/send-message-per-recipient.smtp.js +++ b/packages/local-sync/src/local-sync-worker/syncback-tasks/send-message-per-recipient.smtp.js @@ -69,7 +69,6 @@ class SendMessagePerRecipientSMTP extends SyncbackTask { const account = this._account const baseMessage = await MessageFactory.buildForSend(db, messagePayload) - baseMessage.setIsSending(true) const sendResult = await sendPerRecipient({db, account, baseMessage, usesOpenTracking, usesLinkTracking}) diff --git a/packages/local-sync/src/local-sync-worker/syncback-tasks/send-message.smtp.js b/packages/local-sync/src/local-sync-worker/syncback-tasks/send-message.smtp.js index caae7d903..26562ff3b 100644 --- a/packages/local-sync/src/local-sync-worker/syncback-tasks/send-message.smtp.js +++ b/packages/local-sync/src/local-sync-worker/syncback-tasks/send-message.smtp.js @@ -24,7 +24,6 @@ class SendMessageSMTP extends SyncbackTask { const {messagePayload} = this.syncbackRequestObject().props const message = await MessageFactory.buildForSend(db, messagePayload); - message.setIsSending(true); const logger = global.Logger.forAccount(this._account); const sender = new SendmailClient(this._account, logger); await sender.send(message); diff --git a/packages/local-sync/src/models/message.js b/packages/local-sync/src/models/message.js index e90fd113e..f8c69ee2a 100644 --- a/packages/local-sync/src/models/message.js +++ b/packages/local-sync/src/models/message.js @@ -29,7 +29,7 @@ module.exports = (sequelize, Sequelize) => { // stay in sync with the current message body. isDraft: Sequelize.BOOLEAN, isSent: Sequelize.BOOLEAN, - isSending: Sequelize.BOOLEAN, + isSending: Sequelize.BOOLEAN, // Currently unused, left for potential future use isProcessed: { type: Sequelize.BOOLEAN, defaultValue: false }, unread: Sequelize.BOOLEAN, starred: Sequelize.BOOLEAN, @@ -109,21 +109,6 @@ module.exports = (sequelize, Sequelize) => { return `<${id}@nylas-mail.nylas.com>` }, - // async findMultiSendMessage(db, messageId) { - // const message = await this.findById(messageId, { - // include: [ - // {model: db.Folder}, - // ], - // }) - // if (!message) { - // throw new APIError(`Couldn't find multi-send message ${messageId}`, 400); - // } - // if (message.isSent || !message.isSending) { - // throw new APIError(`Message ${messageId} is not a multi-send message`, 400); - // } - // return message; - // }, - requiredAssociationsForJSON({Folder, Label, File}) { return [ {model: Folder}, @@ -147,22 +132,10 @@ module.exports = (sequelize, Sequelize) => { setIsSent(val) { if (val) { this.isDraft = false - this.isSending = false } this.isSent = val }, - setIsSending(val) { - if (val) { - if (this.isSent || this.isSending) { - throw new APIError('Cannot mark a sent message as sending', 400); - } - validateRecipientsPresent(this); - this.isDraft = false; - } - this.isSending = val - }, - fetchRaw({account, db, logger}) { const settings = Object.assign({}, account.connectionSettings, account.decryptedCredentials()) return PromiseUtils.props({