재현 단계:
다른 사용자의 게시글에 좋아요를 누릅니다.
해당 게시글의 소유권을 가져옵니다.
좋아요 버튼이 두 개 표시되고, 게시글의 좋아요를 취소할 수 없게 됩니다.
소유권을 이전할 때 자신의 게시글에는 좋아요를 누를 수 없도록 하는 로직이 작동하기 때문에, 새 소유자로서 게시글의 좋아요를 취소할 수 없는 것 같습니다.
6개의 좋아요
blake
(Blake Erickson)
8월 14, 2020, 11:45오후
3
이 문제를 해결하기 위해 PR을 생성했습니다:
master ← remove-new-post-owner-self-likes
merged 03:21PM - 19 Aug 20 UTC
If a user has liked a post that has passed the
`post_undo_action_window_mins` s… ystem setting window and you transfer ownership
of that post to that user you will be the owner of a post that you have
liked, but cannot unlike resulting in a weird UI behavior. This commit
fixes this issue.
The existing tests didn't check for the timeout window for unliking
posts so I added that in.
I couldn't find a good way to do this logic inside of the guardian class
so rather than duplicating behavior of the `PostActionDestroyer` class
inside of the `PostOwnerChanger` I decided to pass in a "bypass"
variable that could be used to check if the calling class is the
'post_owner_changer' and bypass the guardian instead. I went this route
because the guardian `can_delete_post_action` method has no way of
distinguishing how to allow a user to be able to unlike their own posts
after the timeout window but only on a post owner change.
확인한 바로는, ‘좋아요 취소’ 타임아웃 기간이 아직 도달하지 않은 경우 소유권 이전이 좋아요를 제거하는 데 정상적으로 작동합니다. 하지만 예를 들어 오래된 게시글처럼 해당 기간이 지난 경우에는, 자신의 게시글에 좋아요를 취소할 수 있는 가디언(guardian) 검사를 통과하지 못해 좋아요가 제거되지 않는 것이 문제의 원인입니다.
2개의 좋아요