From 72803ef3cd857b2deb208096642442a853333f23 Mon Sep 17 00:00:00 2001
From: Patrick Simpson
Date: Tue, 26 Sep 2017 16:34:23 +0200
Subject: [PATCH] [KOE-142] Added exception to checking of shared folder
renaming for secondary contacts, as that renames the folder.
# Conflicts:
# src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs
---
.../SecondaryContacts/FeatureSecondaryContacts.cs | 5 +++++
.../Features/SharedFolders/FeatureSharedFolders.cs | 8 +++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SecondaryContacts/FeatureSecondaryContacts.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SecondaryContacts/FeatureSecondaryContacts.cs
index c21316c..d693456 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SecondaryContacts/FeatureSecondaryContacts.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SecondaryContacts/FeatureSecondaryContacts.cs
@@ -78,6 +78,11 @@ namespace Acacia.Features.SecondaryContacts
}
}
+ public static bool IsSecondaryFolderRename(string oldName, string newName)
+ {
+ return newName + SUFFIX_CONTACTS == oldName;
+ }
+
// Contains the ids of folders for which we've shown a warning. This is both to prevent
// warning multiple times and to detect the case when the app has been restarted.
private readonly HashSet _warnedFolders = new HashSet();
diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs
index 839e2f4..9c2755e 100644
--- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs
+++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/Features/SharedFolders/FeatureSharedFolders.cs
@@ -1,4 +1,4 @@
-/// Copyright 2017 Kopano b.v.
+/// Copyright 2017 Kopano b.v.
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License, version 3,
@@ -13,7 +13,7 @@
/// along with this program.If not, see.
///
/// Consult LICENSE file for details
-
+using Acacia.Features.SecondaryContacts;
using Acacia.Stubs;
using Acacia.UI;
using Acacia.UI.Outlook;
@@ -395,7 +395,9 @@ namespace Acacia.Features.SharedFolders
string originalName = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_NAME);
// The folder.name property is sometimes cached, check against the MAPI property
string currentName = (string)folder.GetProperty(OutlookConstants.PR_DISPLAY_NAME_W);
- if (currentName != originalName)
+ if (currentName != originalName &&
+ // Secondary contacts renames folder, check for that
+ !FeatureSecondaryContacts.IsSecondaryFolderRename(originalName, currentName))
{
Logger.Instance.Warning(this, "Shared folder renamed, renaming back: {0} - {1} - {2}", folder.Name, folder.SyncId, originalName);
// This is a locally renamed folder. Warn and rename back