Skip to content

Commit

Permalink
fix: non-members can view notice posts
Browse files Browse the repository at this point in the history
  • Loading branch information
InJun2 committed Aug 28, 2024
1 parent 39c97d3 commit f3b5dd3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/poolc/api/post/service/PostService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class PostService {
public Post findById(Member member, Long postId) {
Post post = postRepository.findById(postId)
.orElseThrow(() -> new NoSuchElementException("No post found with given post id."));
checkReadPermission(member, post.getBoardType());
if (post.getBoardType() != BoardType.NOTICE) checkReadPermission(member, post.getBoardType());
post.getCommentList().sort(Comparator.comparing(Comment::getCreatedAt));
return post;
}
Expand Down Expand Up @@ -154,7 +154,7 @@ private boolean checkReadPermissionBoolean(Member user, BoardType board) {
}

private boolean checkWritePermissionBoolean(Member user, BoardType board) {
return user != null && user.isMember() && (user.isAdmin() || board != BoardType.NOTICE);
return user != null && user.isMember();
}

private void checkWriter(Member member, Post post) {
Expand Down

0 comments on commit f3b5dd3

Please sign in to comment.