diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Person.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Person.kt index f08b161e..af5e045c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Person.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Person.kt @@ -6,9 +6,9 @@ open class Person @Suppress("LongParameterList") constructor( type: List = emptyList(), - override val name: String, + val name: String?, override val id: String, - var preferredUsername: String?, + var preferredUsername: String, var summary: String?, var inbox: String, var outbox: String, @@ -19,7 +19,7 @@ constructor( var followers: String?, var following: String?, val manuallyApprovesFollowers: Boolean? = false -) : Object(add(type, "Person")), HasId, HasName { +) : Object(add(type, "Person")), HasId { @Suppress("CyclomaticComplexMethod", "CognitiveComplexMethod") override fun equals(other: Any?): Boolean { @@ -67,20 +67,20 @@ constructor( override fun toString(): String { return "Person(" + - "name='$name', " + - "id='$id', " + - "preferredUsername=$preferredUsername, " + - "summary=$summary, " + - "inbox='$inbox', " + - "outbox='$outbox', " + - "url='$url', " + - "icon=$icon, " + - "publicKey=$publicKey, " + - "endpoints=$endpoints, " + - "followers=$followers, " + - "following=$following, " + - "manuallyApprovesFollowers=$manuallyApprovesFollowers" + - ")" + - " ${super.toString()}" + "name='$name', " + + "id='$id', " + + "preferredUsername=$preferredUsername, " + + "summary=$summary, " + + "inbox='$inbox', " + + "outbox='$outbox', " + + "url='$url', " + + "icon=$icon, " + + "publicKey=$publicKey, " + + "endpoints=$endpoints, " + + "followers=$followers, " + + "following=$following, " + + "manuallyApprovesFollowers=$manuallyApprovesFollowers" + + ")" + + " ${super.toString()}" } } diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/objects/user/APUserService.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/objects/user/APUserService.kt index 3b540ebb..009c6821 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/objects/user/APUserService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/objects/user/APUserService.kt @@ -96,7 +96,7 @@ class APUserServiceImpl( name = person.preferredUsername ?: throw IllegalActivityPubObjectException("preferredUsername is null"), domain = id.substringAfter("://").substringBefore("/"), - screenName = person.name, + screenName = person.name ?: person.preferredUsername, description = person.summary.orEmpty(), inbox = person.inbox, outbox = person.outbox,