Fixed folder types

pull/147/head
M66B 6 years ago
parent 3ee30a8662
commit 79937006ff

@ -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" +

@ -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;

@ -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);
}
}

Loading…
Cancel
Save