From c3e945bea247c192b87feff017f3fe042242e87e Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 26 Nov 2018 15:34:07 +0100 Subject: [PATCH] Improved folder flags update --- .../main/java/eu/faircode/email/ServiceSynchronize.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 250e5e8dae..d949399792 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -845,11 +845,7 @@ public class ServiceSynchronize extends LifecycleService { db.folder().setFolderState(folder.id, "connected"); db.folder().setFolderError(folder.id, null); - - List keywords = new ArrayList<>(); - for (String keyword : ifolder.getPermanentFlags().getUserFlags()) - keywords.add(keyword); - db.folder().setFolderKeywords(folder.id, DB.Converters.fromStringArray(keywords.toArray(new String[0]))); + db.folder().setFolderKeywords(folder.id, DB.Converters.fromStringArray(ifolder.getPermanentFlags().getUserFlags())); Log.i(Helper.TAG, account.name + " folder " + folder.name + " flags=" + ifolder.getPermanentFlags()); @@ -1516,6 +1512,8 @@ public class ServiceSynchronize extends LifecycleService { } else keywords.remove(keyword); db.message().setMessageKeywords(message.id, DB.Converters.fromStringArray(keywords.toArray(new String[0]))); + + db.folder().setFolderKeywords(folder.id, DB.Converters.fromStringArray(ifolder.getPermanentFlags().getUserFlags())); } private void doAdd(EntityFolder folder, Session isession, IMAPFolder ifolder, EntityMessage message, JSONArray jargs, DB db) throws MessagingException, JSONException, IOException {