Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static CommunityResponseDTO.PostDTO toPostDTO(Community community, Long c
.build();
}

public static CommunityResponseDTO.PostDetailDTO toPostDetailDTO(Community community, Page<Comment> commentList){
public static CommunityResponseDTO.PostDetailDTO toPostDetailDTO(Community community, Page<Comment> commentList, Boolean isOwner){
List<FileDTO.FileDetailRes> list = new ArrayList<FileDTO.FileDetailRes>();
if(!community.getFileList().isEmpty()){
community.getFileList().stream().forEach(file -> {
Expand All @@ -64,6 +64,7 @@ public static CommunityResponseDTO.PostDetailDTO toPostDetailDTO(Community commu
.content(community.getContent())
.communityWriterEmail(community.getUser().getEmail())
.created_at(community.getCreatedAt())
.isOwner(isOwner)
.fileList(list)
.commentDTOList(comments)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ public CommunityResponseDTO.PostDetailDTO getCommunityDetail(String userId, Long
int end = Math.min((start + pageRequest.getPageSize()), commentList.size());
List<Comment> subList = commentList.subList(start, end);
Page<Comment> commentPage = new PageImpl<>(subList, pageRequest, commentList.size());
return CommunityConverter.toPostDetailDTO(community, commentPage);
boolean isOwner = false;
if(community.getUser().getEmail().equals(user.getEmail())) {
isOwner = true;
}
return CommunityConverter.toPostDetailDTO(community, commentPage, isOwner);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static class PostDetailDTO{
LocalDateTime created_at;
List<FileDTO.FileDetailRes> fileList;
List<CommentDTO> commentDTOList;
Boolean isOwner;
}

@Builder
Expand Down
Loading