From a19b448df29c05d47b77b1c5076c5bef26a2d613 Mon Sep 17 00:00:00 2001
From: usbharu <64310155+usbharu@users.noreply.github.com>
Date: Fri, 21 Apr 2023 19:30:32 +0900
Subject: [PATCH] =?UTF-8?q?fix:=20name=E3=81=8Cnull=E3=81=AE=E3=81=A8?=
=?UTF-8?q?=E3=81=8DpreferredUsername=E3=82=92=E5=A4=89=E3=82=8F=E3=82=8A?=
=?UTF-8?q?=E3=81=AB=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?=
=?UTF-8?q?=E3=81=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/activitypub/ActivityPubUserServiceImpl.kt | 5 ++++-
src/main/resources/logback.xml | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUserServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUserServiceImpl.kt
index 09c4b601..76372479 100644
--- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUserServiceImpl.kt
+++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUserServiceImpl.kt
@@ -16,6 +16,7 @@ import io.ktor.client.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
+import org.slf4j.LoggerFactory
class ActivityPubUserServiceImpl(
private val userService: UserService,
@@ -23,6 +24,8 @@ class ActivityPubUserServiceImpl(
private val httpClient: HttpClient
) :
ActivityPubUserService {
+
+ private val logger = LoggerFactory.getLogger(this::class.java)
override suspend fun getPersonByName(name: String): Person {
// TODO: JOINで書き直し
val userEntity = userService.findByName(name)
@@ -91,7 +94,7 @@ class ActivityPubUserServiceImpl(
name = person.preferredUsername
?: throw IllegalActivityPubObjectException("preferredUsername is null"),
domain = url.substringAfter(":").substringBeforeLast("/"),
- screenName = person.name ?: throw IllegalActivityPubObjectException("name is null"),
+ screenName = (person.name ?: person.preferredUsername) ?: throw IllegalActivityPubObjectException("preferredUsername is null"),
description = person.summary ?: throw IllegalActivityPubObjectException("summary is null"),
inbox = person.inbox ?: throw IllegalActivityPubObjectException("inbox is null"),
outbox = person.outbox ?: throw IllegalActivityPubObjectException("outbox is null"),
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index 60418308..a2c79be6 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -9,4 +9,6 @@
+
+