mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
cleanup folderInformation() request
This commit is contained in:
parent
a9764bf034
commit
7578d18cab
1 changed files with 7 additions and 10 deletions
|
|
@ -96,21 +96,18 @@ refreshFoldersInterval = 300000,
|
||||||
*/
|
*/
|
||||||
folderInformation = (folder, list) => {
|
folderInformation = (folder, list) => {
|
||||||
if (folder?.trim()) {
|
if (folder?.trim()) {
|
||||||
let fetch = !arrayLength(list);
|
let count = 1;
|
||||||
const uids = [],
|
const uids = [];
|
||||||
folderFromCache = getFolderFromCacheList(folder);
|
|
||||||
|
|
||||||
if (!fetch) {
|
if (arrayLength(list)) {
|
||||||
list.forEach(messageListItem => {
|
list.forEach(messageListItem => {
|
||||||
MessageFlagsCache.getFor(folder, messageListItem.uid) || uids.push(messageListItem.uid);
|
MessageFlagsCache.getFor(folder, messageListItem.uid) || uids.push(messageListItem.uid);
|
||||||
messageListItem.threads.forEach(uid => {
|
messageListItem.threads.forEach(uid => MessageFlagsCache.getFor(folder, uid) || uids.push(uid));
|
||||||
MessageFlagsCache.getFor(folder, uid) || uids.push(uid);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
fetch = uids.length;
|
count = uids.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetch) {
|
if (count) {
|
||||||
Remote.request('FolderInformation', (iError, data) => {
|
Remote.request('FolderInformation', (iError, data) => {
|
||||||
if (!iError && data.Result) {
|
if (!iError && data.Result) {
|
||||||
const result = data.Result,
|
const result = data.Result,
|
||||||
|
|
@ -151,7 +148,7 @@ folderInformation = (folder, list) => {
|
||||||
}, {
|
}, {
|
||||||
folder: folder,
|
folder: folder,
|
||||||
flagsUids: uids,
|
flagsUids: uids,
|
||||||
uidNext: folderFromCache?.uidNext || 0 // Used to check for new messages
|
uidNext: getFolderFromCacheList(folder)?.uidNext || 0 // Used to check for new messages
|
||||||
});
|
});
|
||||||
} else if (SettingsUserStore.useThreads()) {
|
} else if (SettingsUserStore.useThreads()) {
|
||||||
MessagelistUserStore.reloadFlagsAndCachedMessage();
|
MessagelistUserStore.reloadFlagsAndCachedMessage();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue