mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-10-06 11:45:48 +08:00
IMAP \archive is not the same \all, so split it
This commit is contained in:
parent
d6071a584e
commit
2def2fc118
5 changed files with 21 additions and 40 deletions
|
@ -21,15 +21,16 @@ import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
||||||
const
|
const
|
||||||
ServerFolderType = {
|
ServerFolderType = {
|
||||||
USER: 0,
|
// USER: 0,
|
||||||
INBOX: 1,
|
INBOX: 1,
|
||||||
SENT: 2,
|
SENT: 2,
|
||||||
DRAFTS: 3,
|
DRAFTS: 3,
|
||||||
JUNK: 4,
|
JUNK: 4,
|
||||||
TRASH: 5,
|
TRASH: 5,
|
||||||
IMPORTANT: 10,
|
// IMPORTANT: 10,
|
||||||
FLAGGED: 11,
|
// FLAGGED: 11,
|
||||||
ALL: 12
|
ARCHIVE: 12
|
||||||
|
// ,ALL: 13
|
||||||
},
|
},
|
||||||
|
|
||||||
normalizeFolder = sFolderFullNameRaw => ('' === sFolderFullNameRaw
|
normalizeFolder = sFolderFullNameRaw => ('' === sFolderFullNameRaw
|
||||||
|
@ -129,7 +130,7 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||||
Settings.set('DraftFolder', this.SystemFolders[ServerFolderType.DRAFTS] || null);
|
Settings.set('DraftFolder', this.SystemFolders[ServerFolderType.DRAFTS] || null);
|
||||||
Settings.set('SpamFolder', this.SystemFolders[ServerFolderType.JUNK] || null);
|
Settings.set('SpamFolder', this.SystemFolders[ServerFolderType.JUNK] || null);
|
||||||
Settings.set('TrashFolder', this.SystemFolders[ServerFolderType.TRASH] || null);
|
Settings.set('TrashFolder', this.SystemFolders[ServerFolderType.TRASH] || null);
|
||||||
Settings.set('ArchiveFolder', this.SystemFolders[ServerFolderType.ALL] || null);
|
Settings.set('ArchiveFolder', this.SystemFolders[ServerFolderType.ARCHIVE] || null);
|
||||||
|
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,29 +75,10 @@ export const FolderUserStore = new class {
|
||||||
|
|
||||||
this.folderListSystemNames = ko.computed(() => {
|
this.folderListSystemNames = ko.computed(() => {
|
||||||
const list = [getFolderInboxName()],
|
const list = [getFolderInboxName()],
|
||||||
sentFolder = this.sentFolder(),
|
others = [this.sentFolder(), this.draftFolder(), this.spamFolder(), this.trashFolder(), this.archiveFolder()];
|
||||||
draftFolder = this.draftFolder(),
|
|
||||||
spamFolder = this.spamFolder(),
|
|
||||||
trashFolder = this.trashFolder(),
|
|
||||||
archiveFolder = this.archiveFolder();
|
|
||||||
|
|
||||||
if (this.folderList.length) {
|
this.folderList().length &&
|
||||||
if (sentFolder && UNUSED_OPTION_VALUE !== sentFolder) {
|
others.forEach(name => name && UNUSED_OPTION_VALUE !== name && list.push(name));
|
||||||
list.push(sentFolder);
|
|
||||||
}
|
|
||||||
if (draftFolder && UNUSED_OPTION_VALUE !== draftFolder) {
|
|
||||||
list.push(draftFolder);
|
|
||||||
}
|
|
||||||
if (spamFolder && UNUSED_OPTION_VALUE !== spamFolder) {
|
|
||||||
list.push(spamFolder);
|
|
||||||
}
|
|
||||||
if (trashFolder && UNUSED_OPTION_VALUE !== trashFolder) {
|
|
||||||
list.push(trashFolder);
|
|
||||||
}
|
|
||||||
if (archiveFolder && UNUSED_OPTION_VALUE !== archiveFolder) {
|
|
||||||
list.push(archiveFolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
});
|
});
|
||||||
|
@ -109,15 +90,11 @@ export const FolderUserStore = new class {
|
||||||
const
|
const
|
||||||
fRemoveSystemFolderType = (observable) => () => {
|
fRemoveSystemFolderType = (observable) => () => {
|
||||||
const folder = getFolderFromCacheList(observable());
|
const folder = getFolderFromCacheList(observable());
|
||||||
if (folder) {
|
folder && folder.type(FolderType.User);
|
||||||
folder.type(FolderType.User);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
fSetSystemFolderType = type => value => {
|
fSetSystemFolderType = type => value => {
|
||||||
const folder = getFolderFromCacheList(value);
|
const folder = getFolderFromCacheList(value);
|
||||||
if (folder) {
|
folder && folder.type(type);
|
||||||
folder.type(type);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.sentFolder.subscribe(fRemoveSystemFolderType(this.sentFolder), this, 'beforeChange');
|
this.sentFolder.subscribe(fRemoveSystemFolderType(this.sentFolder), this, 'beforeChange');
|
||||||
|
|
|
@ -26,5 +26,6 @@ abstract class FolderType
|
||||||
const TRASH = 5;
|
const TRASH = 5;
|
||||||
const IMPORTANT = 10;
|
const IMPORTANT = 10;
|
||||||
const FLAGGED = 11;
|
const FLAGGED = 11;
|
||||||
const ALL = 12;
|
const ARCHIVE = 12;
|
||||||
|
const ALL = 13;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,9 +216,11 @@ class Folder implements \JsonSerializable
|
||||||
case \in_array('\\starred', $aFlags):
|
case \in_array('\\starred', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::FLAGGED;
|
return \MailSo\Imap\Enumerations\FolderType::FLAGGED;
|
||||||
|
|
||||||
|
case \in_array('\\archive', $aFlags):
|
||||||
|
return \MailSo\Imap\Enumerations\FolderType::ARCHIVE;
|
||||||
|
|
||||||
case \in_array('\\all', $aFlags):
|
case \in_array('\\all', $aFlags):
|
||||||
case \in_array('\\allmail', $aFlags):
|
case \in_array('\\allmail', $aFlags):
|
||||||
case \in_array('\\archive', $aFlags):
|
|
||||||
return \MailSo\Imap\Enumerations\FolderType::ALL;
|
return \MailSo\Imap\Enumerations\FolderType::ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ trait Folders
|
||||||
|
|
||||||
if ('' === $oSettingsLocal->GetConf('ArchiveFolder', ''))
|
if ('' === $oSettingsLocal->GetConf('ArchiveFolder', ''))
|
||||||
{
|
{
|
||||||
$aList[] = FolderType::ALL;
|
$aList[] = FolderType::ARCHIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->Plugins()->RunHook('filter.folders-system-types', array($oAccount, &$aList));
|
$this->Plugins()->RunHook('filter.folders-system-types', array($oAccount, &$aList));
|
||||||
|
@ -479,7 +479,7 @@ trait Folders
|
||||||
FolderType::DRAFTS,
|
FolderType::DRAFTS,
|
||||||
FolderType::JUNK,
|
FolderType::JUNK,
|
||||||
FolderType::TRASH,
|
FolderType::TRASH,
|
||||||
FolderType::ALL
|
FolderType::ARCHIVE
|
||||||
)))
|
)))
|
||||||
{
|
{
|
||||||
$aResult[$iFolderType] = $oFolder->FullNameRaw();
|
$aResult[$iFolderType] = $oFolder->FullNameRaw();
|
||||||
|
@ -511,7 +511,7 @@ trait Folders
|
||||||
FolderType::DRAFTS,
|
FolderType::DRAFTS,
|
||||||
FolderType::JUNK,
|
FolderType::JUNK,
|
||||||
FolderType::TRASH,
|
FolderType::TRASH,
|
||||||
FolderType::ALL
|
FolderType::ARCHIVE
|
||||||
)))
|
)))
|
||||||
{
|
{
|
||||||
$aResult[$iFolderType] = $oFolder->FullNameRaw();
|
$aResult[$iFolderType] = $oFolder->FullNameRaw();
|
||||||
|
@ -578,8 +578,8 @@ trait Folders
|
||||||
'Deleted' => FolderType::TRASH,
|
'Deleted' => FolderType::TRASH,
|
||||||
'Bin' => FolderType::TRASH,
|
'Bin' => FolderType::TRASH,
|
||||||
|
|
||||||
'Archive' => FolderType::ALL,
|
'Archive' => FolderType::ARCHIVE,
|
||||||
'Archives' => FolderType::ALL,
|
'Archives' => FolderType::ARCHIVE,
|
||||||
|
|
||||||
'All' => FolderType::ALL,
|
'All' => FolderType::ALL,
|
||||||
'All Mail' => FolderType::ALL,
|
'All Mail' => FolderType::ALL,
|
||||||
|
|
Loading…
Add table
Reference in a new issue