diff --git a/app/src/main/java/eu/faircode/email/DaoAccount.java b/app/src/main/java/eu/faircode/email/DaoAccount.java index 0713a46c69..192a3b54a1 100644 --- a/app/src/main/java/eu/faircode/email/DaoAccount.java +++ b/app/src/main/java/eu/faircode/email/DaoAccount.java @@ -62,7 +62,7 @@ public interface DaoAccount { " FROM account" + " LEFT JOIN folder AS drafts ON drafts.account = account.id" + " WHERE :all OR account.synchronize" + - " AND drafts.type = '" + EntityFolder.DRAFTS + "'" + + " AND (drafts.type = '" + EntityFolder.DRAFTS + "' OR drafts.type IS NULL)" + " GROUP BY account.id" + " ORDER BY CASE WHEN :all THEN 0 ELSE account.`order` END" + ", CASE WHEN :all THEN 0 ELSE account.`primary` END DESC" + diff --git a/app/src/main/java/eu/faircode/email/DaoFolder.java b/app/src/main/java/eu/faircode/email/DaoFolder.java index c482ea7b9e..9919971a64 100644 --- a/app/src/main/java/eu/faircode/email/DaoFolder.java +++ b/app/src/main/java/eu/faircode/email/DaoFolder.java @@ -44,9 +44,9 @@ public interface DaoFolder { " LEFT JOIN rule ON rule.folder = folder.id" + " LEFT JOIN operation ON operation.folder = folder.id" + " WHERE folder.account = :account AND account.synchronize" + - " AND message.ui_hide = 0" + - " AND rule.enabled" + - " AND operation.state = 'executing'" + + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" + + " AND (rule.enabled OR rule.enabled IS NULL)" + + " AND (operation.state = 'executing' OR operation.state IS NULL)" + " GROUP BY folder.id") List getFoldersEx(long account); @@ -85,9 +85,9 @@ public interface DaoFolder { " THEN folder.unified AND account.synchronize" + " ELSE folder.account = :account AND account.synchronize" + " END" + - " AND message.ui_hide = 0" + - " AND rule.enabled" + - " AND operation.state = 'executing'" + + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" + + " AND (rule.enabled OR rule.enabled IS NULL)" + + " AND (operation.state = 'executing' OR operation.state IS NULL)" + " GROUP BY folder.id") LiveData> liveFolders(Long account); @@ -105,9 +105,9 @@ public interface DaoFolder { " LEFT JOIN operation ON operation.folder = folder.id" + " WHERE account.`synchronize`" + " AND folder.unified" + - " AND message.ui_hide = 0" + - " AND rule.enabled" + - " AND operation.state = 'executing'" + + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" + + " AND (rule.enabled OR rule.enabled IS NULL)" + + " AND (operation.state = 'executing' OR operation.state IS NULL)" + " GROUP BY folder.id") LiveData> liveUnified(); @@ -120,7 +120,7 @@ public interface DaoFolder { " LEFT JOIN account ON account.id = folder.account" + " LEFT JOIN message ON message.folder = folder.id" + " WHERE (account.id IS NULL OR (account.`synchronize` AND folder.navigation))" + - " AND message.ui_hide = 0" + + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" + " GROUP BY folder.id") LiveData> liveNavigation(); @@ -149,9 +149,9 @@ public interface DaoFolder { " LEFT JOIN rule ON rule.folder = folder.id" + " LEFT JOIN operation ON operation.folder = folder.id" + " WHERE folder.id = :id" + - " AND message.ui_hide = 0" + - " AND rule.enabled" + - " AND operation.state = 'executing'" + + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" + + " AND (rule.enabled OR rule.enabled IS NULL)" + + " AND (operation.state = 'executing' OR operation.state IS NULL)" + " GROUP BY folder.id") LiveData liveFolderEx(long id);