Skip to content

Commit

Permalink
Merge pull request #6775 from ita-social-projects/tag-users-list-limit
Browse files Browse the repository at this point in the history
[GreenCity] Limit the search query result for Friends List to first 10 items #6774
  • Loading branch information
ABbondar authored Dec 17, 2023
2 parents 9117125 + e4aa2fd commit a44ec83
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ public PageableDto<EcoNewsCommentDto> findAllActiveReplies(Pageable pageable, Lo
}

/**
* Method that allow you to search users by name.
* Method that allow you to search users by name. The search results will be
* limited to the first 10 entries, and the list will decrease as the search
* query is refined.
*
* @param searchUsers dto with current user ID and search query
* {@link UserSearchDto}.
Expand All @@ -354,6 +356,7 @@ public void searchUsers(UserSearchDto searchUsers) {

List<UserTagDto> usersToTag = users.stream()
.map(u -> modelMapper.map(u, UserTagDto.class))
.limit(10)
.collect(Collectors.toList());

messagingTemplate.convertAndSend("/topic/" + searchUsers.getCurrentUserId() + "/searchUsers", usersToTag);
Expand Down

0 comments on commit a44ec83

Please sign in to comment.