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.

This commit is contained in:
Patrick Simpson 2017-09-26 16:34:23 +02:00
parent 04a73157b5
commit 06e90bed30
2 changed files with 11 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
// warning multiple times and to detect the case when the app has been restarted.
private readonly HashSet<string> _warnedFolders = new HashSet<string>();

View File

@ -1,4 +1,6 @@
/// Copyright 2016 Kopano b.v.

using Acacia.Features.SecondaryContacts;
/// Copyright 2016 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 +15,6 @@
/// along with this program.If not, see<http://www.gnu.org/licenses/>.
///
/// Consult LICENSE file for details
using Acacia.Stubs;
using Acacia.UI;
using Acacia.UI.Outlook;
@ -403,7 +404,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