mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-28 07:24:36 +08:00
[local-sync] Remove isSending
bit
Summary: `isSending` was an artifact from the cloud sync engine that was used to double check that the sending process for a multi-send draft had been initiated. I don't believe the intermediate steps are API calls anymore, and we've had the relevant code commented out for awhile. Time to kill it! I've revived the double-sending tests in N1 to ensure we still have sufficient checks against sending the draft again while the first call is still sending. See D3834 Test Plan: N1 unit tests Reviewers: juan, evan Reviewed By: juan, evan Differential Revision: https://phab.nylas.com/D3835
This commit is contained in:
parent
0c34238862
commit
51f34107d4
4 changed files with 1 additions and 31 deletions
|
@ -90,7 +90,6 @@ class SyncWorker {
|
||||||
where: {
|
where: {
|
||||||
folderId: null,
|
folderId: null,
|
||||||
isSent: {$not: true},
|
isSent: {$not: true},
|
||||||
isSending: {$not: true},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const noFolderImapUID = await Message.findAll({
|
const noFolderImapUID = await Message.findAll({
|
||||||
|
|
|
@ -69,7 +69,6 @@ class SendMessagePerRecipientSMTP extends SyncbackTask {
|
||||||
const account = this._account
|
const account = this._account
|
||||||
|
|
||||||
const baseMessage = await MessageFactory.buildForSend(db, messagePayload)
|
const baseMessage = await MessageFactory.buildForSend(db, messagePayload)
|
||||||
baseMessage.setIsSending(true)
|
|
||||||
|
|
||||||
const sendResult = await sendPerRecipient({db, account, baseMessage, usesOpenTracking, usesLinkTracking})
|
const sendResult = await sendPerRecipient({db, account, baseMessage, usesOpenTracking, usesLinkTracking})
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ class SendMessageSMTP extends SyncbackTask {
|
||||||
const {messagePayload} = this.syncbackRequestObject().props
|
const {messagePayload} = this.syncbackRequestObject().props
|
||||||
|
|
||||||
const message = await MessageFactory.buildForSend(db, messagePayload);
|
const message = await MessageFactory.buildForSend(db, messagePayload);
|
||||||
message.setIsSending(true);
|
|
||||||
const logger = global.Logger.forAccount(this._account);
|
const logger = global.Logger.forAccount(this._account);
|
||||||
const sender = new SendmailClient(this._account, logger);
|
const sender = new SendmailClient(this._account, logger);
|
||||||
await sender.send(message);
|
await sender.send(message);
|
||||||
|
|
|
@ -29,7 +29,7 @@ module.exports = (sequelize, Sequelize) => {
|
||||||
// stay in sync with the current message body.
|
// stay in sync with the current message body.
|
||||||
isDraft: Sequelize.BOOLEAN,
|
isDraft: Sequelize.BOOLEAN,
|
||||||
isSent: Sequelize.BOOLEAN,
|
isSent: Sequelize.BOOLEAN,
|
||||||
isSending: Sequelize.BOOLEAN,
|
isSending: Sequelize.BOOLEAN, // Currently unused, left for potential future use
|
||||||
isProcessed: { type: Sequelize.BOOLEAN, defaultValue: false },
|
isProcessed: { type: Sequelize.BOOLEAN, defaultValue: false },
|
||||||
unread: Sequelize.BOOLEAN,
|
unread: Sequelize.BOOLEAN,
|
||||||
starred: Sequelize.BOOLEAN,
|
starred: Sequelize.BOOLEAN,
|
||||||
|
@ -109,21 +109,6 @@ module.exports = (sequelize, Sequelize) => {
|
||||||
return `<${id}@nylas-mail.nylas.com>`
|
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}) {
|
requiredAssociationsForJSON({Folder, Label, File}) {
|
||||||
return [
|
return [
|
||||||
{model: Folder},
|
{model: Folder},
|
||||||
|
@ -147,22 +132,10 @@ module.exports = (sequelize, Sequelize) => {
|
||||||
setIsSent(val) {
|
setIsSent(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.isDraft = false
|
this.isDraft = false
|
||||||
this.isSending = false
|
|
||||||
}
|
}
|
||||||
this.isSent = val
|
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}) {
|
fetchRaw({account, db, logger}) {
|
||||||
const settings = Object.assign({}, account.connectionSettings, account.decryptedCredentials())
|
const settings = Object.assign({}, account.connectionSettings, account.decryptedCredentials())
|
||||||
return PromiseUtils.props({
|
return PromiseUtils.props({
|
||||||
|
|
Loading…
Add table
Reference in a new issue