mirror of https://github.com/usbharu/Hideout.git
feat: Undo Announceを受け取れるように
This commit is contained in:
parent
ac5be2e2df
commit
09165783ae
|
@ -12,6 +12,7 @@ import dev.usbharu.hideout.core.domain.exception.resource.UserNotFoundException
|
||||||
import dev.usbharu.hideout.core.domain.exception.resource.local.LocalUserNotFoundException
|
import dev.usbharu.hideout.core.domain.exception.resource.local.LocalUserNotFoundException
|
||||||
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
|
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
|
||||||
import dev.usbharu.hideout.core.domain.model.post.PostRepository
|
import dev.usbharu.hideout.core.domain.model.post.PostRepository
|
||||||
|
import dev.usbharu.hideout.core.service.post.PostService
|
||||||
import dev.usbharu.hideout.core.service.reaction.ReactionService
|
import dev.usbharu.hideout.core.service.reaction.ReactionService
|
||||||
import dev.usbharu.hideout.core.service.relationship.RelationshipService
|
import dev.usbharu.hideout.core.service.relationship.RelationshipService
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
@ -23,7 +24,8 @@ class APUndoProcessor(
|
||||||
private val relationshipService: RelationshipService,
|
private val relationshipService: RelationshipService,
|
||||||
private val reactionService: ReactionService,
|
private val reactionService: ReactionService,
|
||||||
private val actorRepository: ActorRepository,
|
private val actorRepository: ActorRepository,
|
||||||
private val postRepository: PostRepository
|
private val postRepository: PostRepository,
|
||||||
|
private val postService: PostService
|
||||||
) : AbstractActivityPubProcessor<Undo>(transaction) {
|
) : AbstractActivityPubProcessor<Undo>(transaction) {
|
||||||
override suspend fun internalProcess(activity: ActivityPubProcessContext<Undo>) {
|
override suspend fun internalProcess(activity: ActivityPubProcessContext<Undo>) {
|
||||||
val undo = activity.activity
|
val undo = activity.activity
|
||||||
|
@ -53,6 +55,11 @@ class APUndoProcessor(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Announce" -> {
|
||||||
|
announce(undo)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
TODO()
|
TODO()
|
||||||
|
@ -109,6 +116,13 @@ class APUndoProcessor(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun announce(undo: Undo) {
|
||||||
|
val announce = undo.apObject as Announce
|
||||||
|
|
||||||
|
val findByApId = postRepository.findByApId(announce.id) ?: return
|
||||||
|
postService.deleteRemote(findByApId)
|
||||||
|
}
|
||||||
|
|
||||||
override fun isSupported(activityType: ActivityType): Boolean = activityType == ActivityType.Undo
|
override fun isSupported(activityType: ActivityType): Boolean = activityType == ActivityType.Undo
|
||||||
|
|
||||||
override fun type(): Class<Undo> = Undo::class.java
|
override fun type(): Class<Undo> = Undo::class.java
|
||||||
|
|
Loading…
Reference in New Issue