From b3d07cde38aec2395be4c7970cf22eeec2bda7e5 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 30 Jun 2026 21:36:31 +0900 Subject: [PATCH] =?UTF-8?q?fix(community):=20=EC=9C=A0=EB=A3=8C=20?= =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=B5=9C=EA=B7=BC=20=EC=86=8C?= =?UTF-8?q?=EC=8B=9D=20=EB=B0=9C=ED=96=89=EC=9D=84=20=EB=A7=89=EB=8A=94?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreatorCommunityService.kt | 2 ++ .../CreatorCommunityServiceTest.kt | 19 ++++--------------- .../HomeFollowingNewsPublishServiceTest.kt | 4 ++-- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt index 77dd3649..96cd4fda 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt @@ -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 { diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityServiceTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityServiceTest.kt index b7d1dee5..48c91ca1 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityServiceTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityServiceTest.kt @@ -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(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 diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/v2/home/following/application/HomeFollowingNewsPublishServiceTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/v2/home/following/application/HomeFollowingNewsPublishServiceTest.kt index 882bf4cb..a0407c2d 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/v2/home/following/application/HomeFollowingNewsPublishServiceTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/v2/home/following/application/HomeFollowingNewsPublishServiceTest.kt @@ -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)