mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Prevent to check empty folder name
This commit is contained in:
parent
b50464afeb
commit
33b3be62ef
4 changed files with 151 additions and 145 deletions
|
|
@ -238,96 +238,99 @@ RainLoopApp.prototype.quota = function ()
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.folderInformation = function (sFolder, aList)
|
RainLoopApp.prototype.folderInformation = function (sFolder, aList)
|
||||||
{
|
{
|
||||||
this.remote().folderInformation(function (sResult, oData) {
|
if ('' !== Utils.trim(sFolder))
|
||||||
if (Enums.StorageResultType.Success === sResult)
|
{
|
||||||
{
|
this.remote().folderInformation(function (sResult, oData) {
|
||||||
if (oData && oData.Result && oData.Result.Hash && oData.Result.Folder)
|
if (Enums.StorageResultType.Success === sResult)
|
||||||
{
|
{
|
||||||
var
|
if (oData && oData.Result && oData.Result.Hash && oData.Result.Folder)
|
||||||
sHash = RL.cache().getFolderHash(oData.Result.Folder),
|
|
||||||
oFolder = RL.cache().getFolderFromCacheList(oData.Result.Folder),
|
|
||||||
bCheck = false,
|
|
||||||
sUid = '',
|
|
||||||
aList = [],
|
|
||||||
bUnreadCountChange = false,
|
|
||||||
oFlags = null
|
|
||||||
;
|
|
||||||
|
|
||||||
if (oFolder)
|
|
||||||
{
|
{
|
||||||
if (oData.Result.Hash)
|
var
|
||||||
{
|
sHash = RL.cache().getFolderHash(oData.Result.Folder),
|
||||||
RL.cache().setFolderHash(oData.Result.Folder, oData.Result.Hash);
|
oFolder = RL.cache().getFolderFromCacheList(oData.Result.Folder),
|
||||||
}
|
bCheck = false,
|
||||||
|
sUid = '',
|
||||||
|
aList = [],
|
||||||
|
bUnreadCountChange = false,
|
||||||
|
oFlags = null
|
||||||
|
;
|
||||||
|
|
||||||
if (Utils.isNormal(oData.Result.MessageCount))
|
if (oFolder)
|
||||||
{
|
{
|
||||||
oFolder.messageCountAll(oData.Result.MessageCount);
|
if (oData.Result.Hash)
|
||||||
}
|
|
||||||
|
|
||||||
if (Utils.isNormal(oData.Result.MessageUnseenCount))
|
|
||||||
{
|
|
||||||
if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount))
|
|
||||||
{
|
{
|
||||||
bUnreadCountChange = true;
|
RL.cache().setFolderHash(oData.Result.Folder, oData.Result.Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
|
if (Utils.isNormal(oData.Result.MessageCount))
|
||||||
}
|
|
||||||
|
|
||||||
if (bUnreadCountChange)
|
|
||||||
{
|
|
||||||
RL.cache().clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oData.Result.Flags)
|
|
||||||
{
|
|
||||||
for (sUid in oData.Result.Flags)
|
|
||||||
{
|
{
|
||||||
if (oData.Result.Flags.hasOwnProperty(sUid))
|
oFolder.messageCountAll(oData.Result.MessageCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utils.isNormal(oData.Result.MessageUnseenCount))
|
||||||
|
{
|
||||||
|
if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount))
|
||||||
{
|
{
|
||||||
bCheck = true;
|
bUnreadCountChange = true;
|
||||||
oFlags = oData.Result.Flags[sUid];
|
}
|
||||||
RL.cache().storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [
|
|
||||||
!oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded']
|
oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
|
||||||
]);
|
}
|
||||||
|
|
||||||
|
if (bUnreadCountChange)
|
||||||
|
{
|
||||||
|
RL.cache().clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oData.Result.Flags)
|
||||||
|
{
|
||||||
|
for (sUid in oData.Result.Flags)
|
||||||
|
{
|
||||||
|
if (oData.Result.Flags.hasOwnProperty(sUid))
|
||||||
|
{
|
||||||
|
bCheck = true;
|
||||||
|
oFlags = oData.Result.Flags[sUid];
|
||||||
|
RL.cache().storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [
|
||||||
|
!oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bCheck)
|
||||||
|
{
|
||||||
|
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bCheck)
|
RL.data().initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
|
||||||
{
|
|
||||||
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RL.data().initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
|
if (oData.Result.Hash !== sHash || '' === sHash)
|
||||||
|
|
||||||
if (oData.Result.Hash !== sHash || '' === sHash)
|
|
||||||
{
|
|
||||||
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
|
|
||||||
{
|
{
|
||||||
RL.reloadMessageList();
|
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
|
||||||
}
|
|
||||||
else if ('INBOX' === oFolder.fullNameRaw)
|
|
||||||
{
|
|
||||||
RL.recacheInboxMessageList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (bUnreadCountChange)
|
|
||||||
{
|
|
||||||
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
|
|
||||||
{
|
|
||||||
aList = RL.data().messageList();
|
|
||||||
if (Utils.isNonEmptyArray(aList))
|
|
||||||
{
|
{
|
||||||
RL.folderInformation(oFolder.fullNameRaw, aList);
|
RL.reloadMessageList();
|
||||||
|
}
|
||||||
|
else if ('INBOX' === oFolder.fullNameRaw)
|
||||||
|
{
|
||||||
|
RL.recacheInboxMessageList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bUnreadCountChange)
|
||||||
|
{
|
||||||
|
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
|
||||||
|
{
|
||||||
|
aList = RL.data().messageList();
|
||||||
|
if (Utils.isNonEmptyArray(aList))
|
||||||
|
{
|
||||||
|
RL.folderInformation(oFolder.fullNameRaw, aList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}, sFolder, aList);
|
||||||
}, sFolder, aList);
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.setMessageSeen = function (oMessage)
|
RainLoopApp.prototype.setMessageSeen = function (oMessage)
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ MailBoxScreen.prototype.onStart = function ()
|
||||||
|
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
var sFolder = RL.data().spamFolder();
|
var sFolder = RL.data().spamFolder();
|
||||||
if (sFolder !== oData.currentFolderFullNameRaw())
|
if (sFolder !== oData.currentFolderFullNameRaw() && '' !== sFolder)
|
||||||
{
|
{
|
||||||
RL.folderInformation(sFolder);
|
RL.folderInformation(sFolder);
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +86,7 @@ MailBoxScreen.prototype.onStart = function ()
|
||||||
|
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
var sFolder = RL.data().draftFolder();
|
var sFolder = RL.data().draftFolder();
|
||||||
if (sFolder !== oData.currentFolderFullNameRaw())
|
if (sFolder !== oData.currentFolderFullNameRaw() && '' !== sFolder)
|
||||||
{
|
{
|
||||||
RL.folderInformation(sFolder);
|
RL.folderInformation(sFolder);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15129,7 +15129,7 @@ MailBoxScreen.prototype.onStart = function ()
|
||||||
|
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
var sFolder = RL.data().spamFolder();
|
var sFolder = RL.data().spamFolder();
|
||||||
if (sFolder !== oData.currentFolderFullNameRaw())
|
if (sFolder !== oData.currentFolderFullNameRaw() && '' !== sFolder)
|
||||||
{
|
{
|
||||||
RL.folderInformation(sFolder);
|
RL.folderInformation(sFolder);
|
||||||
}
|
}
|
||||||
|
|
@ -15137,7 +15137,7 @@ MailBoxScreen.prototype.onStart = function ()
|
||||||
|
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
var sFolder = RL.data().draftFolder();
|
var sFolder = RL.data().draftFolder();
|
||||||
if (sFolder !== oData.currentFolderFullNameRaw())
|
if (sFolder !== oData.currentFolderFullNameRaw() && '' !== sFolder)
|
||||||
{
|
{
|
||||||
RL.folderInformation(sFolder);
|
RL.folderInformation(sFolder);
|
||||||
}
|
}
|
||||||
|
|
@ -15701,96 +15701,99 @@ RainLoopApp.prototype.quota = function ()
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.folderInformation = function (sFolder, aList)
|
RainLoopApp.prototype.folderInformation = function (sFolder, aList)
|
||||||
{
|
{
|
||||||
this.remote().folderInformation(function (sResult, oData) {
|
if ('' !== Utils.trim(sFolder))
|
||||||
if (Enums.StorageResultType.Success === sResult)
|
{
|
||||||
{
|
this.remote().folderInformation(function (sResult, oData) {
|
||||||
if (oData && oData.Result && oData.Result.Hash && oData.Result.Folder)
|
if (Enums.StorageResultType.Success === sResult)
|
||||||
{
|
{
|
||||||
var
|
if (oData && oData.Result && oData.Result.Hash && oData.Result.Folder)
|
||||||
sHash = RL.cache().getFolderHash(oData.Result.Folder),
|
|
||||||
oFolder = RL.cache().getFolderFromCacheList(oData.Result.Folder),
|
|
||||||
bCheck = false,
|
|
||||||
sUid = '',
|
|
||||||
aList = [],
|
|
||||||
bUnreadCountChange = false,
|
|
||||||
oFlags = null
|
|
||||||
;
|
|
||||||
|
|
||||||
if (oFolder)
|
|
||||||
{
|
{
|
||||||
if (oData.Result.Hash)
|
var
|
||||||
{
|
sHash = RL.cache().getFolderHash(oData.Result.Folder),
|
||||||
RL.cache().setFolderHash(oData.Result.Folder, oData.Result.Hash);
|
oFolder = RL.cache().getFolderFromCacheList(oData.Result.Folder),
|
||||||
}
|
bCheck = false,
|
||||||
|
sUid = '',
|
||||||
|
aList = [],
|
||||||
|
bUnreadCountChange = false,
|
||||||
|
oFlags = null
|
||||||
|
;
|
||||||
|
|
||||||
if (Utils.isNormal(oData.Result.MessageCount))
|
if (oFolder)
|
||||||
{
|
{
|
||||||
oFolder.messageCountAll(oData.Result.MessageCount);
|
if (oData.Result.Hash)
|
||||||
}
|
|
||||||
|
|
||||||
if (Utils.isNormal(oData.Result.MessageUnseenCount))
|
|
||||||
{
|
|
||||||
if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount))
|
|
||||||
{
|
{
|
||||||
bUnreadCountChange = true;
|
RL.cache().setFolderHash(oData.Result.Folder, oData.Result.Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
|
if (Utils.isNormal(oData.Result.MessageCount))
|
||||||
}
|
|
||||||
|
|
||||||
if (bUnreadCountChange)
|
|
||||||
{
|
|
||||||
RL.cache().clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oData.Result.Flags)
|
|
||||||
{
|
|
||||||
for (sUid in oData.Result.Flags)
|
|
||||||
{
|
{
|
||||||
if (oData.Result.Flags.hasOwnProperty(sUid))
|
oFolder.messageCountAll(oData.Result.MessageCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utils.isNormal(oData.Result.MessageUnseenCount))
|
||||||
|
{
|
||||||
|
if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount))
|
||||||
{
|
{
|
||||||
bCheck = true;
|
bUnreadCountChange = true;
|
||||||
oFlags = oData.Result.Flags[sUid];
|
}
|
||||||
RL.cache().storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [
|
|
||||||
!oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded']
|
oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
|
||||||
]);
|
}
|
||||||
|
|
||||||
|
if (bUnreadCountChange)
|
||||||
|
{
|
||||||
|
RL.cache().clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oData.Result.Flags)
|
||||||
|
{
|
||||||
|
for (sUid in oData.Result.Flags)
|
||||||
|
{
|
||||||
|
if (oData.Result.Flags.hasOwnProperty(sUid))
|
||||||
|
{
|
||||||
|
bCheck = true;
|
||||||
|
oFlags = oData.Result.Flags[sUid];
|
||||||
|
RL.cache().storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [
|
||||||
|
!oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bCheck)
|
||||||
|
{
|
||||||
|
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bCheck)
|
RL.data().initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
|
||||||
{
|
|
||||||
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RL.data().initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
|
if (oData.Result.Hash !== sHash || '' === sHash)
|
||||||
|
|
||||||
if (oData.Result.Hash !== sHash || '' === sHash)
|
|
||||||
{
|
|
||||||
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
|
|
||||||
{
|
{
|
||||||
RL.reloadMessageList();
|
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
|
||||||
}
|
|
||||||
else if ('INBOX' === oFolder.fullNameRaw)
|
|
||||||
{
|
|
||||||
RL.recacheInboxMessageList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (bUnreadCountChange)
|
|
||||||
{
|
|
||||||
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
|
|
||||||
{
|
|
||||||
aList = RL.data().messageList();
|
|
||||||
if (Utils.isNonEmptyArray(aList))
|
|
||||||
{
|
{
|
||||||
RL.folderInformation(oFolder.fullNameRaw, aList);
|
RL.reloadMessageList();
|
||||||
|
}
|
||||||
|
else if ('INBOX' === oFolder.fullNameRaw)
|
||||||
|
{
|
||||||
|
RL.recacheInboxMessageList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bUnreadCountChange)
|
||||||
|
{
|
||||||
|
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
|
||||||
|
{
|
||||||
|
aList = RL.data().messageList();
|
||||||
|
if (Utils.isNonEmptyArray(aList))
|
||||||
|
{
|
||||||
|
RL.folderInformation(oFolder.fullNameRaw, aList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}, sFolder, aList);
|
||||||
}, sFolder, aList);
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.setMessageSeen = function (oMessage)
|
RainLoopApp.prototype.setMessageSeen = function (oMessage)
|
||||||
|
|
|
||||||
2
rainloop/v/0.0.0/static/js/app.min.js
vendored
2
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue