fix: ローカル投稿削除の配送が行われていなかった問題を修正

This commit is contained in:
usbharu 2024-01-16 15:14:24 +09:00
parent bb7bf7abc8
commit bf2c50c445
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package dev.usbharu.hideout.core.service.post package dev.usbharu.hideout.core.service.post
import dev.usbharu.hideout.activitypub.service.activity.create.ApSendCreateService import dev.usbharu.hideout.activitypub.service.activity.create.ApSendCreateService
import dev.usbharu.hideout.activitypub.service.activity.delete.APSendDeleteService
import dev.usbharu.hideout.core.domain.exception.UserNotFoundException import dev.usbharu.hideout.core.domain.exception.UserNotFoundException
import dev.usbharu.hideout.core.domain.exception.resource.DuplicateException import dev.usbharu.hideout.core.domain.exception.resource.DuplicateException
import dev.usbharu.hideout.core.domain.exception.resource.PostNotFoundException import dev.usbharu.hideout.core.domain.exception.resource.PostNotFoundException
@ -21,7 +22,8 @@ class PostServiceImpl(
private val timelineService: TimelineService, private val timelineService: TimelineService,
private val postBuilder: Post.PostBuilder, private val postBuilder: Post.PostBuilder,
private val apSendCreateService: ApSendCreateService, private val apSendCreateService: ApSendCreateService,
private val reactionRepository: ReactionRepository private val reactionRepository: ReactionRepository,
private val apSendDeleteService: APSendDeleteService
) : PostService { ) : PostService {
override suspend fun createLocal(post: PostCreateDto): Post { override suspend fun createLocal(post: PostCreateDto): Post {
@ -50,6 +52,8 @@ class PostServiceImpl(
val actor = actorRepository.findById(post.actorId) val actor = actorRepository.findById(post.actorId)
?: throw IllegalStateException("actor: ${post.actorId} was not found.") ?: throw IllegalStateException("actor: ${post.actorId} was not found.")
apSendDeleteService.sendDeleteNote(post)
actorRepository.save(actor.decrementPostsCount()) actorRepository.save(actor.decrementPostsCount())
} }