Skip to content

Commit

Permalink
Merge pull request #6417 from ita-social-projects/bug-friends-not-fri…
Browse files Browse the repository at this point in the history
…ends-yet

fix bug with search people with symbols
  • Loading branch information
2or5 authored Sep 27, 2023
2 parents e570412 + b0c1bc4 commit b95f10f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dao/src/main/java/greencity/repository/UserRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
+ " SELECT user_id AS id FROM users_friends WHERE friend_id = :userId AND status = 'FRIEND' "
+ " UNION "
+ " SELECT friend_id AS id FROM users_friends WHERE user_id = :userId AND status = 'FRIEND' "
+ ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', :filteringName, '%')) ")
+ ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', REPLACE(REPLACE(REPLACE(REPLACE(:filteringName, '&', '\\&'), "
+ "'%', '\\%'), '_', '\\_'), '#', '\\#'), '%')) ")
Page<User> getAllUsersExceptMainUserAndFriends(Long userId, String filteringName, Pageable pageable);

/**
Expand Down Expand Up @@ -316,4 +317,4 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
+ " SELECT friend_id AS id FROM users_friends WHERE user_id = :userId AND status = 'FRIEND' "
+ ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', :filteringName, '%'))")
Page<User> findAllFriendsOfUser(Long userId, String filteringName, Pageable pageable);
}
}

0 comments on commit b95f10f

Please sign in to comment.