Stop duplicate inboxes being created, not being listed
Since duplicates are being cleand up on startup, this ensures dups never exist in the DB.
This commit is contained in:
parent
46bb4d1b6c
commit
41bb79da94
1 changed files with 10 additions and 10 deletions
|
|
@ -369,10 +369,19 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
|
||||
// XXX this should really be a db table constraint
|
||||
Geary.ImapDB.Folder? folder = get_local_folder(path);
|
||||
if (folder != null)
|
||||
if (folder != null) {
|
||||
throw new EngineError.ALREADY_EXISTS(
|
||||
"Folder with path already exists: %s", path.to_string()
|
||||
);
|
||||
}
|
||||
|
||||
if (Imap.MailboxSpecifier.folder_path_is_inbox(path) &&
|
||||
!Imap.MailboxSpecifier.is_canonical_inbox_name(path.basename)) {
|
||||
// Don't add faux inboxes
|
||||
throw new ImapError.NOT_SUPPORTED(
|
||||
"Inbox has : %s", path.to_string()
|
||||
);
|
||||
}
|
||||
|
||||
yield db.exec_transaction_async(Db.TransactionType.RW, (cx) => {
|
||||
// get the parent of this folder, creating parents if necessary ... ok if this fails,
|
||||
|
|
@ -507,15 +516,6 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
while (!result.finished) {
|
||||
string basename = result.string_for("name");
|
||||
|
||||
// ignore anything that's not canonical Inbox
|
||||
if (parent == null
|
||||
&& Imap.MailboxSpecifier.is_inbox_name(basename)
|
||||
&& !Imap.MailboxSpecifier.is_canonical_inbox_name(basename)) {
|
||||
result.next(cancellable);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Geary.FolderPath path = (parent != null)
|
||||
? parent.get_child(basename)
|
||||
: new Imap.FolderRoot(basename);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue