fix(community): 유료 게시글 최근 소식 발행을 막는다

This commit is contained in:
2026-06-30 21:36:31 +09:00
parent 5d5547361c
commit b3d07cde38
3 changed files with 8 additions and 17 deletions

View File

@@ -145,6 +145,8 @@ class CreatorCommunityService(
}
private fun publishCommunityPostCreatedAfterCommit(post: CreatorCommunity, member: Member) {
if (post.price > 0) return
val occurredAtUtc = post.createdAt ?: LocalDateTime.now()
val newsContent = post.newsContentPreview()
afterCommit {

View File

@@ -330,15 +330,14 @@ class CreatorCommunityServiceTest {
}
@Test
@DisplayName("유료 커뮤니티 게시글 최근 소식은 전체 본문을 노출하지 않고 미리보기만 발행한")
fun shouldPublishPaidCommunityPostNewsWithMaskedContent() {
@DisplayName("유료 커뮤니티 게시글 생성 성공 후 최근 소식을 발행하지 않는")
fun shouldNotPublishNewsAfterPaidCommunityPostCreated() {
val creator = createMember(id = 910L, role = MemberRole.CREATOR, nickname = "paid-community-creator")
val fullContent = "유료 커뮤니티 게시글 전체 본문은 최근 소식에서 노출되면 안 됩니다"
val createdAt = LocalDateTime.of(2026, 6, 25, 11, 0)
Mockito.`when`(repository.save(Mockito.any(CreatorCommunity::class.java))).thenAnswer { invocation ->
val post = invocation.getArgument<CreatorCommunity>(0)
post.id = 911L
post.createdAt = createdAt
post.createdAt = LocalDateTime.of(2026, 6, 25, 11, 0)
post
}
Mockito.`when`(
@@ -357,17 +356,7 @@ class CreatorCommunityServiceTest {
member = creator
)
Mockito.verify(homeFollowingNewsPublishService).publishCommunityPostCreated(
postId = 911L,
creatorId = creator.id!!,
creatorNickname = creator.nickname!!,
creatorProfileImagePath = creator.profileImage,
title = "유료 커뮤니티 게시글 전체 ...",
body = "유료 커뮤니티 게시글 전체 ...",
thumbnailImagePath = "creator_community/911/911-image.png",
occurredAtUtc = createdAt,
isAdult = false
)
Mockito.verifyNoInteractions(homeFollowingNewsPublishService)
}
@Test

View File

@@ -10,8 +10,8 @@ import java.time.LocalDateTime
class HomeFollowingNewsPublishServiceTest {
@Test
@DisplayName("커뮤니티 게시글 발행은 현재 활성 팔로워에게만 inbox record를 생성한다")
fun shouldPublishCommunityPostCreatedToActiveFollowers() {
@DisplayName("무료 커뮤니티 게시글 발행은 현재 활성 팔로워에게만 inbox record를 생성한다")
fun shouldPublishFreeCommunityPostCreatedToActiveFollowers() {
val inboxPort = FakeHomeFollowingNewsInboxPort(activeFollowerIds = listOf(1L, 2L))
val service = HomeFollowingNewsPublishService(inboxPort)
val occurredAtUtc = LocalDateTime.of(2026, 6, 25, 1, 2, 3)