Skip to content

Commit

Permalink
fix: correction sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieuaudemard committed May 5, 2023
1 parent 67036b1 commit 522f2b7
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ public Long countFriendRequestsByUsername(final String username) {
private Predicate[] generateFilterPredicates(final String username, final RelationCriteriaEnum relationCriteria, final CriteriaQuery<?> query) {
final Root<ProfileModel> p = query.from(ProfileModel.class);
final CriteriaBuilder builder = entityManager.getCriteriaBuilder();
final List<Predicate> queryPredicates = new ArrayList<>() {{
add(builder.isTrue(p.get("user").get("enabled")));
add(builder.notEqual(p.get("user").get("username"), username));
}};
final List<Predicate> queryPredicates = new ArrayList<>();
queryPredicates.add(builder.isTrue(p.get("user").get("enabled")));
queryPredicates.add(builder.notEqual(p.get("user").get("username"), username));

if (List.of(ALL_FRIENDS, ONLY_FRIEND_REQUESTS).contains(relationCriteria)) {
final Subquery<Integer> subQuery = query.subquery(Integer.class);
Expand Down

0 comments on commit 522f2b7

Please sign in to comment.