Merge pull request #4650 from k9mail/clean_up_FolderClass

Remove obsolete FolderClass.NONE
This commit is contained in:
cketti 2020-04-09 22:24:22 +02:00 committed by GitHub
commit d0ea3ccaa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 4 deletions

View file

@ -934,7 +934,7 @@ public class LocalStore {
folder.create();
}
folder.setName(folderName);
folder.setSyncClass(FolderClass.NONE);
folder.setSyncClass(FolderClass.NO_CLASS);
}
static String serializeFlags(Iterable<Flag> flags) {

View file

@ -12,7 +12,7 @@ import timber.log.Timber;
class StoreSchemaDefinition implements SchemaDefinition {
static final int DB_VERSION = 70;
static final int DB_VERSION = 71;
private final MigrationsHelper migrationsHelper;

View file

@ -0,0 +1,16 @@
package com.fsck.k9.storage.migrations
import android.database.sqlite.SQLiteDatabase
internal class MigrationTo71(private val db: SQLiteDatabase) {
fun cleanUpFolderClass() {
db.execSQL("UPDATE folders SET poll_class = 'NO_CLASS' " +
"WHERE poll_class NOT IN ('NO_CLASS', 'INHERITED', 'FIRST_CLASS', 'SECOND_CLASS')")
db.execSQL("UPDATE folders SET push_class = 'NO_CLASS' " +
"WHERE push_class NOT IN ('NO_CLASS', 'INHERITED', 'FIRST_CLASS', 'SECOND_CLASS')")
db.execSQL("UPDATE folders SET display_class = 'NO_CLASS' " +
"WHERE display_class NOT IN ('NO_CLASS', 'INHERITED', 'FIRST_CLASS', 'SECOND_CLASS')")
db.execSQL("UPDATE folders SET notify_class = 'NO_CLASS' " +
"WHERE notify_class NOT IN ('NO_CLASS', 'INHERITED', 'FIRST_CLASS', 'SECOND_CLASS')")
}
}

View file

@ -27,6 +27,8 @@ public class Migrations {
new MigrationTo69(db).createPendingDelete();
case 69:
new MigrationTo70(db).removePushState();
case 70:
new MigrationTo71(db).cleanUpFolderClass();
}
}
}

View file

@ -1,6 +1,5 @@
package com.fsck.k9.mail;
// NONE is obsolete, it will be translated to NO_CLASS for display and to INHERITED for sync and push
public enum FolderClass {
NONE, NO_CLASS, INHERITED, FIRST_CLASS, SECOND_CLASS
NO_CLASS, INHERITED, FIRST_CLASS, SECOND_CLASS
}