feat: フォロー承認を取り消しの方法を追加

This commit is contained in:
usbharu 2023-12-11 12:29:08 +09:00
parent de5bc691bc
commit 31e69f8141
1 changed files with 21 additions and 0 deletions

View File

@ -1,8 +1,10 @@
package dev.usbharu.hideout.activitypub.service.activity.undo
import dev.usbharu.hideout.activitypub.domain.model.Accept
import dev.usbharu.hideout.activitypub.domain.model.Block
import dev.usbharu.hideout.activitypub.domain.model.Follow
import dev.usbharu.hideout.activitypub.domain.model.Undo
import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectValue
import dev.usbharu.hideout.activitypub.service.common.AbstractActivityPubProcessor
import dev.usbharu.hideout.activitypub.service.common.ActivityPubProcessContext
import dev.usbharu.hideout.activitypub.service.common.ActivityType
@ -50,6 +52,25 @@ class APUndoProcessor(
return
}
"Accept" -> {
val accept = undo.apObject as Accept
val acceptObject = if (accept.apObject is ObjectValue) {
accept.apObject.`object`
} else if (accept.apObject is Follow) {
accept.apObject.apObject
} else {
logger.warn("FAILED Unsupported type. Undo Accept {}", accept.apObject.type)
return
}
val accepter = apUserService.fetchPersonWithEntity(undo.actor, acceptObject).second
val target = userQueryService.findByUrl(acceptObject)
relationshipService.rejectFollowRequest(accepter.id, target.id)
}
else -> {}
}
TODO()