Skip to content

Commit

Permalink
SAK-50491 site-manage sorting of participants in Manage Participants …
Browse files Browse the repository at this point in the history
…tab should comply with requirement of transitivity (#12897)
  • Loading branch information
jkjanetschek authored Oct 8, 2024
1 parent 9612399 commit 2d01001
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,31 @@ public String getDisplayId() {
}

public int compareTo(Participant participantB) {
UserSortNameComparator comparator = new UserSortNameComparator();
User userA = null;
User userB = null;
String uniqnameB = participantB.getUniqname();

if (uniqname == null || uniqnameB == null) {
return uniqname == uniqnameB ? 0 : (uniqname == null ? -1 : 1);
}

try {
userA = UserDirectoryService.getUser(uniqname);
userB = UserDirectoryService.getUser(participantB.getUniqname());
return comparator.compare(userA, userB);
} catch (UserNotDefinedException e) {
if (userA == null && userB == null) {
return 0;
}
else if (userA == null) {
return -1;
}
else if (userB == null) {
return 1;
}
} catch (UserNotDefinedException e) {}
try {
userB = UserDirectoryService.getUser(uniqnameB);
} catch (UserNotDefinedException e) {}


if (userA == null && userB == null) {
return 0;
} else if (userA == null) {
return -1;
} else if (userB == null) {
return 1;
}

return 0;
return new UserSortNameComparator().compare(userA, userB);
}

} // Participant

0 comments on commit 2d01001

Please sign in to comment.