Fixes: U4-3558 members tree syncing is a bit strange and not showing the selected member

This commit is contained in:
Shannon
2013-11-18 15:58:53 +11:00
parent f8e17b711e
commit 21e3893528
7 changed files with 81 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ namespace Umbraco.Web.Trees
int total;
nodes.AddRange(
Membership.Provider.FindUsersByName(id + "%", 0, 9999, out total).Cast<MembershipUser>()
.Select(m => CreateTreeNode(m.ProviderUserKey.ToString(), id, queryStrings, m.UserName, "icon-user")));
.Select(m => CreateTreeNode(GetNodeIdForCustomProvider(m.ProviderUserKey), id, queryStrings, m.UserName, "icon-user")));
}
}
else if (id == "others")
@@ -75,6 +75,22 @@ namespace Umbraco.Web.Trees
return nodes;
}
/// <summary>
/// We'll see if it is a GUID, if so we'll ensure to format it without hyphens
/// </summary>
/// <param name="providerUserKey"></param>
/// <returns></returns>
private string GetNodeIdForCustomProvider(object providerUserKey)
{
if (providerUserKey == null) throw new ArgumentNullException("providerUserKey");
var guidAttempt = providerUserKey.TryConvertTo<Guid>();
if (guidAttempt.Success)
{
return guidAttempt.Result.ToString("N");
}
return providerUserKey.ToString();
}
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();