Attempt to optimize changeFolderTask can cause it to be invalid

This commit is contained in:
Ben Gotow 2017-09-07 19:16:27 -07:00
parent 40e932074a
commit 5a18196c6d

View file

@ -32,16 +32,10 @@ export default class ChangeFolderTask extends ChangeMailTask {
} }
if (!data.previousFolders) { if (!data.previousFolders) {
data.previousFolders = {}; data.previousFolders = {};
} for (const t of (data.threads || [])) {
if (data.threads) { data.previousFolders[t.id] = t.folders.find(f => f.id !== data.folder.id) || t.folders[0];
data.threads = data.threads.filter(t => t.folders.find(f => f.id !== data.folder.id));
for (const t of data.threads) {
data.previousFolders[t.id] = t.folders.find(f => f.id !== data.folder.id);
} }
} for (const m of (data.messages || [])) {
if (data.messages) {
data.messages = data.messages.filter(m => m.folder.id !== data.folder.id);
for (const m of data.messages) {
data.previousFolders[m.id] = m.folder; data.previousFolders[m.id] = m.folder;
} }
} }