FolderInformation Result.Flags use Object.entries()

This commit is contained in:
djmaze 2021-08-16 18:10:45 +02:00
parent 1c95eab6d6
commit 8498290d93

View file

@ -537,8 +537,7 @@ class AppUser extends AbstractApp {
Remote.folderInformation( Remote.folderInformation(
(iError, data) => { (iError, data) => {
if (!iError && data.Result.Hash && data.Result.Folder) { if (!iError && data.Result.Hash && data.Result.Folder) {
let uid = '', let check = false,
check = false,
unreadCountChange = false; unreadCountChange = false;
const folderFromCache = getFolderFromCacheList(data.Result.Folder); const folderFromCache = getFolderFromCacheList(data.Result.Folder);
@ -566,19 +565,16 @@ class AppUser extends AbstractApp {
} }
if (data.Result.Flags) { if (data.Result.Flags) {
for (uid in data.Result.Flags) { Object.entries(data.Result.Flags).forEach(([uid,flags]) => {
if (Object.prototype.hasOwnProperty.call(data.Result.Flags, uid)) { check = true;
check = true; MessageFlagsCache.storeByFolderAndUid(folderFromCache.fullNameRaw, uid.toString(), [
const flags = data.Result.Flags[uid]; !!flags.IsUnseen,
MessageFlagsCache.storeByFolderAndUid(folderFromCache.fullNameRaw, uid.toString(), [ !!flags.IsFlagged,
!!flags.IsUnseen, !!flags.IsAnswered,
!!flags.IsFlagged, !!flags.IsForwarded,
!!flags.IsAnswered, !!flags.IsReadReceipt
!!flags.IsForwarded, ]);
!!flags.IsReadReceipt });
]);
}
}
if (check) { if (check) {
this.reloadFlagsCurrentMessageListAndMessageFromCache(); this.reloadFlagsCurrentMessageListAndMessageFromCache();