1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

[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
This commit is contained in:
Patrick Simpson 2017-09-26 16:34:23 +02:00
parent 484dac10be
commit 72803ef3cd
2 changed files with 10 additions and 3 deletions

View File

@ -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 // 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. // warning multiple times and to detect the case when the app has been restarted.
private readonly HashSet<string> _warnedFolders = new HashSet<string>(); private readonly HashSet<string> _warnedFolders = new HashSet<string>();

View File

@ -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 /// 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, /// it under the terms of the GNU Affero General Public License, version 3,
@ -13,7 +13,7 @@
/// along with this program.If not, see<http://www.gnu.org/licenses/>. /// along with this program.If not, see<http://www.gnu.org/licenses/>.
/// ///
/// Consult LICENSE file for details /// Consult LICENSE file for details
using Acacia.Features.SecondaryContacts;
using Acacia.Stubs; using Acacia.Stubs;
using Acacia.UI; using Acacia.UI;
using Acacia.UI.Outlook; using Acacia.UI.Outlook;
@ -395,7 +395,9 @@ namespace Acacia.Features.SharedFolders
string originalName = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_NAME); string originalName = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_NAME);
// The folder.name property is sometimes cached, check against the MAPI property // The folder.name property is sometimes cached, check against the MAPI property
string currentName = (string)folder.GetProperty(OutlookConstants.PR_DISPLAY_NAME_W); 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); 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 // This is a locally renamed folder. Warn and rename back