[geary/wip/181-special-folder-dupes: 5/7] Stop duplicate inboxes being created, not being listed
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/181-special-folder-dupes: 5/7] Stop duplicate inboxes being created, not being listed
- Date: Mon, 14 Jan 2019 05:28:23 +0000 (UTC)
commit 41bb79da9426907551bc7086be10eb27162f4b00
Author: Michael Gratton <mike vee net>
Date: Mon Jan 14 12:05:29 2019 +1100
Stop duplicate inboxes being created, not being listed
Since duplicates are being cleand up on startup, this ensures dups
never exist in the DB.
src/engine/imap-db/imap-db-account.vala | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-account.vala b/src/engine/imap-db/imap-db-account.vala
index 0353fd2d..f6f77f31 100644
--- a/src/engine/imap-db/imap-db-account.vala
+++ b/src/engine/imap-db/imap-db-account.vala
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]