Skip to content

Commit

Permalink
Make sure each id/email is only requested once
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrdoherty committed Mar 20, 2024
1 parent 8572888 commit fed8330
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Model/src/main/java/org/gusdb/wdk/model/user/UserFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -177,10 +178,14 @@ public void resetPassword(String loginName) throws InvalidUsernameOrEmailExcepti
// -------------------------------------------------------------------------

public Map<Long, User> getUsersById(List<Long> userIds) {
// ensure a unique list
userIds = new ArrayList<>(new HashSet<>(userIds));
return OAuthQuerier.getUsersById(_client, _config, userIds, json -> new BasicUser(_wdkModel, json));
}

public Map<String, User> getUsersByEmail(List<String> emails) {
// ensure a unique list
emails = new ArrayList<>(new HashSet<>(emails));
return OAuthQuerier.getUsersByEmail(_client, _config, emails, json -> new BasicUser(_wdkModel, json));
}

Expand Down

0 comments on commit fed8330

Please sign in to comment.