From 854c61385f8cb1293b7e109187e564902c0d718c Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Sun, 22 Dec 2024 13:30:30 -0800 Subject: [PATCH] Issue 40987: Notify list swaps users when display name matches email address --- api/src/org/labkey/api/security/UserManager.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/api/src/org/labkey/api/security/UserManager.java b/api/src/org/labkey/api/security/UserManager.java index e9be0dd6f1e..fd712817e7e 100644 --- a/api/src/org/labkey/api/security/UserManager.java +++ b/api/src/org/labkey/api/security/UserManager.java @@ -1181,10 +1181,16 @@ public static List parseUserListInput(Set theList) { if (null == (name = StringUtils.trimToNull(name))) continue; - User u = null; - try { u = getUser(new ValidEmail(name)); } catch (ValidEmail.InvalidEmailException ignored) {} - if (null == u) - u = getUserByDisplayName(name); + // First try by display name. See issue 40987 + User u = getUserByDisplayName(name); + if (u == null) + { + try + { + u = getUser(new ValidEmail(name)); + } + catch (ValidEmail.InvalidEmailException ignored) {} + } parsed.add(null == u ? name : String.valueOf(u.getUserId())); } return parsed;