Search

갤러리 댓글 권한 / 이미지 수정

유형
File
이미지처리
Thymeleaf
권한
Contribution
Date
2023/04/12
링크
비고
갤러리 댓글 권한 / 프로필 이미지 뜨도록 수정
게시글 작성자가 아니면 수정과 삭제를 할수 없게는 되어있지만, 댓글 또한 그렇게 되어있어서 수정하였습니다. 또한 프로필 이미지도 넣어보았습니다!
댓글을 클릭하면 수정 버튼이 나오도록 수정하였습니다. 삭제의 경우는 게시글 작성자도 할 수 있습니다. 하지만 게시글 작성자는 댓글을 클릭해도 수정 폼을 보지 못합니다.
댓글 수정은 게시글을 쓴 사람이 아닌 댓글 작성자가 쓸수 있도록 만들기
이부분의 authorize 부분을 삭제하고,
<th:block sec:authorize="isAuthenticated()" th:if="${gallery.userId eq #authentication.name}">
Java
복사
댓글 부분을 이렇게 수정해주었습니다.
<div sec:authorize="isAuthenticated()" th:if="${comment.userId eq #authentication.name}" id="modify" style="width: 520px; height: 20px; margin: 20px 0 50px 120px; display: none" class="container__comment__hidden" th:id="'input' + ${comment.context}">
Java
복사
프로필 이미지의 경우 아래와 같이 작성해주었습니다.
<div class="profile"> <div th:if="${comment.userId eq #authentication.name}"> <img style="width: 70px; height: 70px; border-radius: 50%" th:src="@{/profile/download(pfIdx=${profile?.pfIdx})}"> </div> <div th:unless="${comment.userId eq #authentication.name}">[[${comment.userId}]] </div> </div>
Java
복사