Skip to content

Commit

Permalink
FAForever#2024 fix a bug when all users of 'chat only' group disappea…
Browse files Browse the repository at this point in the history
…rs for

typing on username search field
  • Loading branch information
IvanPavilionG7 committed Nov 15, 2020
1 parent 2f537b1 commit dd9657a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/main/java/com/faforever/client/chat/UserFilterController.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,18 @@ public void filterUsers() {
}

private boolean filterUser(CategoryOrChatUserListItem userListItem) {
if (userListItem.getCategory() != null) {

// The categories should display in the list independently of a filter
return true;
}

ChatChannelUser user = userListItem.getUser();
return userListItem.getCategory() != null
|| (channelTabController.isUsernameMatch(user)
return channelTabController.isUsernameMatch(user)
&& isInClan(user)
&& isBoundByRating(user)
&& isGameStatusMatch(user)
&& isCountryMatch(user));
&& isCountryMatch(user);
}

private void filterCountry() {
Expand Down Expand Up @@ -178,7 +183,14 @@ boolean isGameStatusMatch(ChatChannelUser chatUser) {

boolean isCountryMatch(ChatChannelUser chatUser) {
Optional<Player> playerOptional = chatUser.getPlayer();
if (!playerOptional.isPresent()) {
if (playerOptional.isEmpty()) {

// Usually, users of this category has no country name (`null` value) so need to check for empty string.
if (chatUser.getChatUserCategories().contains(ChatUserCategory.CHAT_ONLY) &&
countryFilterField.getText().isEmpty() && chatUser.getCountryName().isEmpty()) {
return true;
}

return false;
}

Expand Down

0 comments on commit dd9657a

Please sign in to comment.