Skip to content

Commit

Permalink
fix: 자기 자신 게시물도 전체 게시물 조회시 뜨도록 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
1winhyun committed Nov 12, 2024
1 parent f9c9626 commit c18e061
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -107,11 +108,13 @@ public List<PostResponseDTO> getAllPosts(String currentMemberTag){
.stream()
.map(FollowDTO.Response::tag)
.toList();
List<String> changedFollowTags = new ArrayList<>(followTags);
changedFollowTags.add(currentMemberTag);

List<Post>posts=postRepository.findAll()
.stream()
.filter(post -> post.getParentPost()==null)//댓글 게시물은 필터링
.filter(post-> followTags.contains(post.getAuthor().getTag()))//팔로우한 사람의 게시물만 뜨게
.filter(post-> changedFollowTags.contains(post.getAuthor().getTag()))//팔로우한 사람의 게시물만 뜨게
.collect(Collectors.toList());

return posts.stream()
Expand Down

0 comments on commit c18e061

Please sign in to comment.