Browse code

BM-14889 Fix: expand minor change detection

Thomas Fricker authored on 05/06/2019 09:27:20
Showing 1 changed files
... ...
@@ -43,6 +43,7 @@ import net.bluemind.core.container.hierarchy.hook.HierarchyIdsHints;
43 43
 import net.bluemind.core.container.model.Container;
44 44
 import net.bluemind.core.container.model.ContainerDescriptor;
45 45
 import net.bluemind.core.container.model.ContainerModifiableDescriptor;
46
+import net.bluemind.core.container.model.ItemFlag;
46 47
 import net.bluemind.core.container.model.ItemIdentifier;
47 48
 import net.bluemind.core.container.model.ItemValue;
48 49
 import net.bluemind.core.container.model.ItemVersion;
... ...
@@ -101,9 +102,8 @@ public class DbReplicatedMailboxesService extends BaseReplicatedMailboxesService
101 102
 		sanitizeNames(replica);
102 103
 		ItemValue<MailboxFolder> previous = getComplete(uid);
103 104
 		if (previous != null) {
104
-
105 105
 			ItemVersion upd = storeService.update(uid, replica.name, replica);
106
-			boolean minorChange = previous.value.fullName.equals(replica.fullName);
106
+			boolean minorChange = isMinorChange(replica, previous);
107 107
 			if (!minorChange) {
108 108
 				String recordsContainerUid = IMailReplicaUids.mboxRecords(uid);
109 109
 				SubtreeLocation sl = SubtreeLocations.locations.getIfPresent(uid);
... ...
@@ -124,6 +124,13 @@ public class DbReplicatedMailboxesService extends BaseReplicatedMailboxesService
124 124
 		}
125 125
 	}
126 126
 
127
+	private boolean isMinorChange(MailboxReplica replica, ItemValue<MailboxFolder> previous) {
128
+		boolean sameName = previous.value.fullName.equals(replica.fullName);
129
+		boolean deletionStatusUnchanged = previous.flags.contains(ItemFlag.Deleted) == replica.deleted;
130
+
131
+		return sameName && deletionStatusUnchanged;
132
+	}
133
+
127 134
 	@Override
128 135
 	public void delete(String uid) {
129 136
 		IDbMailboxRecords recordsApi = null;