Skip to content

Commit 38ae611

Browse files
committed
fix(like, bookmark) : #75 - 사용자 인식 에러 수정
1 parent 0d7043a commit 38ae611

2 files changed

Lines changed: 1 addition & 14 deletions

File tree

src/main/java/com/example/FixLog/controller/Controller

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/main/java/com/example/FixLog/service/PostService.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,15 @@ public String togglePostLike(Long postIdInput){
201201
// 게시글 북마크
202202
public String toggleBookmark(Long postIdInput){
203203
Member member = memberService.getCurrentMemberInfo();
204-
205204
Post postId = postRepository.findById(postIdInput)
206205
.orElseThrow(() -> new CustomException(ErrorCode.POST_NOT_FOUND));
207206

208207
BookmarkFolder folderId = bookmarkFolderRepository.findByUserId(member); // 이 코드는 폴더가 하나일 때만 적용됨
209208
Optional<Bookmark> optionalBookmark = bookmarkRepository.findByFolderIdAndPostId(folderId, postId);
210209

211210
// 본인 글은 북마크 못하도록
212-
if (member == folderId.getUserId())
211+
if (member == postId.getUserId())
213212
throw new CustomException(ErrorCode.SELF_BOOKMARK_NOT_ALLOWED);
214-
215213
// 북마크 처리
216214
if (optionalBookmark.isEmpty()){ // 객체 없는 경우
217215
Bookmark newBookmark = new Bookmark(folderId, postId);

0 commit comments

Comments
 (0)