From d141b60ab22e66edf8e81c3a5b0ca4cb2a7a024c Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 2 Jun 2023 17:11:52 +0900 Subject: [PATCH] =?UTF-8?q?style:=20=E3=82=B9=E3=82=BF=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/usbharu/hideout/domain/model/hideout/entity/User.kt | 4 +++- .../service/activitypub/ActivityPubNoteServiceImpl.kt | 3 ++- .../hideout/service/activitypub/ActivityPubServiceImpl.kt | 5 ++++- .../service/activitypub/ActivityPubUndoServiceImpl.kt | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt index 1c6dd4a6..45af9cc2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt @@ -17,6 +17,8 @@ data class User( val createdAt: Instant ) { override fun toString(): String { - return "User(id=$id, name='$name', domain='$domain', screenName='$screenName', description='$description', password=****, inbox='$inbox', outbox='$outbox', url='$url', publicKey='$publicKey', privateKey=****, createdAt=$createdAt)" + return "User(id=$id, name='$name', domain='$domain', screenName='$screenName', description='$description'," + + " password=****, inbox='$inbox', outbox='$outbox', url='$url', publicKey='$publicKey'," + + " privateKey=****, createdAt=$createdAt)" } } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt index 461ffb5a..15259d37 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt @@ -100,7 +100,8 @@ class ActivityPubNoteServiceImpl( url: String ): Note { val person = activityPubUserService.fetchPerson( - note.attributedTo ?: throw IllegalActivityPubObjectException("note.attributedTo is null"), targetActor + note.attributedTo ?: throw IllegalActivityPubObjectException("note.attributedTo is null"), + targetActor ) val user = userService.findByUrl(person.url ?: throw IllegalActivityPubObjectException("person.url is null")) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt index 821cecfd..058fbede 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt @@ -64,7 +64,10 @@ class ActivityPubServiceImpl( override suspend fun processActivity(job: JobContextWithProps, hideoutJob: HideoutJob) { logger.debug("processActivity: ${hideoutJob.name}") when (hideoutJob) { - ReceiveFollowJob -> activityPubReceiveFollowService.receiveFollowJob(job.props as JobProps) + ReceiveFollowJob -> activityPubReceiveFollowService.receiveFollowJob( + job.props as JobProps + ) + DeliverPostJob -> activityPubNoteService.createNoteJob(job.props as JobProps) } } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUndoServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUndoServiceImpl.kt index d8bf3e5d..ab6c32fd 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUndoServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUndoServiceImpl.kt @@ -9,6 +9,7 @@ import io.ktor.http.* import org.koin.core.annotation.Single @Single +@Suppress("UnsafeCallOnNullableType") class ActivityPubUndoServiceImpl( private val userService: IUserService, private val activityPubUserService: ActivityPubUserService