Fixed folder types

This commit is contained in:
M66B 2018-12-31 10:04:18 +00:00
parent 3ee30a8662
commit 79937006ff
3 changed files with 8 additions and 3 deletions

View File

@ -161,7 +161,8 @@ public interface DaoFolder {
@Query("UPDATE folder" +
" SET type = '" + EntityFolder.USER + "'" +
" WHERE account = :account")
" WHERE account = :account" +
" AND type <> '" + EntityFolder.SYSTEM + "'")
int setFoldersUser(long account);
@Query("UPDATE folder" +

View File

@ -816,8 +816,12 @@ public class FragmentAccount extends FragmentEx {
}
db.folder().setFoldersUser(account.id);
for (EntityFolder folder : folders) {
folder.level = EntityFolder.getLevel(separator, folder.name);
if (account.prefix != null && folder.name.startsWith(account.prefix + separator))
folder.display = folder.name.substring(account.prefix.length() + 1);
EntityFolder existing = db.folder().getFolderByName(account.id, folder.name);
if (existing == null) {
folder.account = account.id;

View File

@ -2025,10 +2025,10 @@ public class ServiceSynchronize extends LifecycleService {
db.folder().setFolderLevel(folder.id, level);
// Compatibility
if ("Inbox_sub".equals(folder.type))
db.folder().setFolderType(folder.id, EntityFolder.USER);
else if (EntityFolder.USER.equals(folder.type) &&
type != null && !EntityFolder.USER.equals(type))
if (EntityFolder.USER.equals(folder.type) && EntityFolder.SYSTEM.equals(type))
db.folder().setFolderType(folder.id, type);
}
}