Skip to content

Commit

Permalink
Feat(#197): 추천친구 이미 친구일 때 안 나오도록 수정 (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
inhooo00 authored Nov 28, 2024
1 parent 8fecf29 commit 214de75
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,9 @@ public Page<RecommendedFollowInfoResDto> findRecommendedFollowList(Long memberId

potentialFriends = potentialFriends.stream().distinct().collect(Collectors.toList());

// 친구 관계 여부 확인을 위한 로직 추가
List<RecommendedFollowInfoResDto> recommendedFollows = potentialFriends.stream()
.filter(teamMember -> !teamMember.getId().equals(memberId)) // 본인 제외
.map(teamMember -> {
// 현재 추천 대상 사용자가 팔로우 관계인지 확인
.filter(teamMember -> {
boolean isFollow = queryFactory
.selectOne()
.from(follow)
Expand All @@ -148,9 +146,9 @@ public Page<RecommendedFollowInfoResDto> findRecommendedFollowList(Long memberId
.and(follow.toMember.id.eq(memberId)))
)
.fetchFirst() != null;

return RecommendedFollowInfoResDto.from(teamMember, isFollow);
return !isFollow;
})
.map(teamMember -> RecommendedFollowInfoResDto.from(teamMember, false))
.collect(Collectors.toList());

int start = (int) pageable.getOffset();
Expand Down

0 comments on commit 214de75

Please sign in to comment.