mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-12 02:58:20 +08:00
🎨(task-factory)
This commit is contained in:
parent
00832b5a83
commit
b9511e75b2
1 changed files with 7 additions and 3 deletions
|
@ -58,13 +58,15 @@ const TaskFactory = {
|
|||
taskDescription,
|
||||
}))
|
||||
} else {
|
||||
if (catsToAdd.length === 0 && catsToRemove.length === 0) return;
|
||||
if (catsToAdd.length === 0 && catsToRemove.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const labelsToAdd = catsToAdd.filter((cat) => !cat.isGmailFolder())
|
||||
const labelsToRemove = catsToRemove.filter((cat) => !cat.isGmailFolder())
|
||||
const foldersToAdd = catsToAdd.filter((cat) => cat.isGmailFolder())
|
||||
if (foldersToAdd.length > 1) {
|
||||
throw new Error("tasksForApplyingCategories: `categoriesToAdd` for Gmail accounts must contain at most one of inbox, trash or spam")
|
||||
throw new Error("tasksForApplyingCategories: `categoriesToAdd` for Gmail accounts must contain at most one of either archive, trash or spam")
|
||||
}
|
||||
if (foldersToAdd.length > 0) {
|
||||
const folder = foldersToAdd[0]
|
||||
|
@ -82,7 +84,9 @@ const TaskFactory = {
|
|||
}))
|
||||
}
|
||||
|
||||
if (labelsToAdd.length === 0 && labelsToRemove.length === 0) return;
|
||||
if (labelsToAdd.length === 0 && labelsToRemove.length === 0) {
|
||||
return
|
||||
}
|
||||
tasks.push(new ChangeLabelsTask({
|
||||
threads: threadsToUpdate,
|
||||
labelsToRemove,
|
||||
|
|
Loading…
Reference in a new issue