mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-11 23:24:32 +08:00
fix(sync) Make sure we can correctly archive/delete/mark as spam
Summary: Previously, when moving to trash or spam, we were not correctly removing the inbox category. This produced slightly different results because the generated task was slightly different. Also, in ChangeMailTask we were removing the locks on the models before the tasks had actually succeeded-- these locks allowed us to ignore deltas on those models while the task was in progress, so removing them before it completed caused threads to flicker when performing actions This depends on D3829 which also properly addresses archiving/deleting/moving to spam threads that contain sent messages Addresses T7757 and #2706 Test Plan: unit Reviewers: evan, halla, spang Reviewed By: evan, halla, spang Differential Revision: https://phab.nylas.com/D3830
This commit is contained in:
parent
d2580b691b
commit
dd8b860be2
3 changed files with 5 additions and 6 deletions
|
@ -237,11 +237,12 @@ export default class ChangeLabelsTask extends ChangeMailTask {
|
||||||
|
|
||||||
requestBodyForModel(model) {
|
requestBodyForModel(model) {
|
||||||
const folder = model.labels.find(l => l.object === 'folder')
|
const folder = model.labels.find(l => l.object === 'folder')
|
||||||
const labels = model.labels.filter(l => l.object === 'label').map(l => l.id)
|
const labels = model.labels.filter(l => l.object === 'label')
|
||||||
|
|
||||||
if (folder) {
|
if (folder) {
|
||||||
return {
|
return {
|
||||||
labels,
|
|
||||||
folder: folder.id,
|
folder: folder.id,
|
||||||
|
labels: labels.map(l => l.id),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {labels};
|
return {labels};
|
||||||
|
|
|
@ -235,10 +235,6 @@ export default class ChangeMailTask extends Task {
|
||||||
if (!this._syncbackRequestIds) this._syncbackRequestIds = {}
|
if (!this._syncbackRequestIds) this._syncbackRequestIds = {}
|
||||||
this._syncbackRequestIds[model.id] = syncbackRequest.id
|
this._syncbackRequestIds[model.id] = syncbackRequest.id
|
||||||
},
|
},
|
||||||
beforeProcessing: (body) => {
|
|
||||||
this._removeLock(model);
|
|
||||||
return body;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.run()
|
.run()
|
||||||
|
|
|
@ -109,6 +109,7 @@ const TaskFactory = {
|
||||||
source,
|
source,
|
||||||
threads,
|
threads,
|
||||||
categoriesToAdd: (accountId) => [CategoryStore.getSpamCategory(accountId)],
|
categoriesToAdd: (accountId) => [CategoryStore.getSpamCategory(accountId)],
|
||||||
|
categoriesToRemove: (accountId) => [CategoryStore.getInboxCategory(accountId)],
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -128,6 +129,7 @@ const TaskFactory = {
|
||||||
source,
|
source,
|
||||||
threads,
|
threads,
|
||||||
categoriesToAdd: (accountId) => [CategoryStore.getTrashCategory(accountId)],
|
categoriesToAdd: (accountId) => [CategoryStore.getTrashCategory(accountId)],
|
||||||
|
categoriesToRemove: (accountId) => [CategoryStore.getInboxCategory(accountId)],
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue