Fixed resetting folder types

This commit is contained in:
M66B 2019-02-02 11:50:57 +00:00
parent ba116353d9
commit 7e2479d138
3 changed files with 5 additions and 9 deletions

View File

@ -69,11 +69,6 @@ public interface DaoFolder {
" GROUP BY folder.id")
LiveData<List<TupleFolderEx>> liveFolders(Long account);
@Query("SELECT * FROM folder" +
" WHERE (:account < 0 OR folder.account = :account)" +
" AND type <> '" + EntityFolder.USER + "'")
LiveData<List<EntityFolder>> liveSystemFolders(long account);
@Query("SELECT folder.*, account.name AS accountName, account.color AS accountColor, account.state AS accountState" +
", COUNT(message.id) AS messages" +
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
@ -170,6 +165,7 @@ public interface DaoFolder {
@Query("UPDATE folder" +
" SET type = '" + EntityFolder.USER + "'" +
" WHERE account = :account" +
" AND type <> '" + EntityFolder.INBOX + "'" +
" AND type <> '" + EntityFolder.SYSTEM + "'")
int setFoldersUser(long account);

View File

@ -116,14 +116,14 @@ public class EntityFolder implements Serializable {
"Flagged"
);
private static final List<String> SYSTEM_FOLDER_TYPE = Arrays.asList(
ARCHIVE,
ARCHIVE, // All
ARCHIVE,
DRAFTS,
TRASH,
JUNK,
SENT,
SYSTEM,
SYSTEM
SYSTEM, // Important
SYSTEM // Flagged
); // MUST match SYSTEM_FOLDER_ATTR
static final List<String> FOLDER_SORT_ORDER = Arrays.asList(

View File

@ -2218,7 +2218,7 @@ public class ServiceSynchronize extends LifecycleService {
folder.account = account.id;
folder.name = fullName;
folder.display = display;
folder.type = EntityFolder.USER;
folder.type = (EntityFolder.SYSTEM.equals(type) ? type : EntityFolder.USER);
folder.level = level;
folder.synchronize = false;
folder.poll = ("imap.gmail.com".equals(account.host));