mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-25 08:35:16 +08:00
[client-app] don't override existing bodies on K2
Summary: Bodies that already exist on K2 shouldn't be overridden. See the comment for how this caused open/link tracking to fail in certain cases when a lot of messages were being sent Test Plan: manual Reviewers: halla, mark, spang, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D4319
This commit is contained in:
parent
1864a2d48a
commit
96685bed01
2 changed files with 17 additions and 2 deletions
|
@ -5,6 +5,7 @@ React = require 'react'
|
|||
TaskQueue,
|
||||
Actions,
|
||||
Contact,
|
||||
Utils,
|
||||
Message} = require 'nylas-exports'
|
||||
{InjectedComponentSet} = require 'nylas-component-kit'
|
||||
|
||||
|
@ -153,7 +154,7 @@ class DeveloperBar extends React.Component
|
|||
@setState(section: section)
|
||||
|
||||
_getStateFromStores: =>
|
||||
queue: TaskQueue._queue
|
||||
queue: Utils.deepClone(TaskQueue._queue)
|
||||
completed: TaskQueue._completed
|
||||
curlHistory: DeveloperBarStore.curlHistory()
|
||||
longPollHistory: DeveloperBarStore.longPollHistory()
|
||||
|
|
|
@ -274,7 +274,21 @@ class MessageProcessor {
|
|||
async _processExistingMessage({existingMessage, messageValues, struct} = {}) {
|
||||
const {accountId} = messageValues;
|
||||
const db = await LocalDatabaseConnector.forAccount(accountId);
|
||||
await existingMessage.update(messageValues);
|
||||
|
||||
/**
|
||||
* There should never be a reason to update the body of a message
|
||||
* already in the database.
|
||||
*
|
||||
* When we use link/open tracking on Gmail, we optimistically create a
|
||||
* Message whose body is stripped of tracking pixels (so you don't
|
||||
* self trigger). Since it takes time to delete the old draft on Gmail
|
||||
* & restuff, it's possible to sync a message with a non-stripped body
|
||||
* (which would cause you to self-trigger)). This prevents this from
|
||||
* happening.
|
||||
*/
|
||||
const newMessageWithoutBody = _.clone(messageValues)
|
||||
delete newMessageWithoutBody.body;
|
||||
await existingMessage.update(newMessageWithoutBody);
|
||||
if (messageValues.labels && messageValues.labels.length > 0) {
|
||||
await existingMessage.setLabels(messageValues.labels)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue