From 3b64cbea5238ca74cf98efd64c33903eb5799d79 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sat, 29 Apr 2023 18:27:15 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Create=E3=81=ABid=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/dev/usbharu/hideout/domain/model/ap/Create.kt | 6 ++++-- .../kotlin/dev/usbharu/hideout/domain/model/ap/Key.kt | 4 +--- .../kotlin/dev/usbharu/hideout/domain/model/ap/Note.kt | 8 +++++--- .../kotlin/dev/usbharu/hideout/domain/model/ap/Object.kt | 4 +++- .../kotlin/dev/usbharu/hideout/domain/model/ap/Person.kt | 4 +--- .../service/activitypub/ActivityPubNoteServiceImpl.kt | 3 ++- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Create.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Create.kt index 4739176a..540e57aa 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Create.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Create.kt @@ -8,11 +8,13 @@ open class Create : Object { type: List = emptyList(), name: String? = null, `object`: Object?, - actor: String? = null + actor: String? = null, + id: String? = null ) : super( add(type, "Create"), name, - actor + actor, + id ) { this.`object` = `object` } diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Key.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Key.kt index 3b1f168a..935a531b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Key.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Key.kt @@ -1,7 +1,6 @@ package dev.usbharu.hideout.domain.model.ap open class Key : Object { - var id: String? = null var owner: String? = null var publicKeyPem: String? = null @@ -12,8 +11,7 @@ open class Key : Object { id: String?, owner: String?, publicKeyPem: String? - ) : super(add(type, "Key"), name) { - this.id = id + ) : super(add(type, "Key"), name,id) { this.owner = owner this.publicKeyPem = publicKeyPem } diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Note.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Note.kt index 0250301c..e62fccc2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Note.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Note.kt @@ -1,7 +1,6 @@ package dev.usbharu.hideout.domain.model.ap open class Note : Object { - var id: String? = null var attributedTo: String? = null var content: String? = null var published: String? = null @@ -16,8 +15,11 @@ open class Note : Object { content: String?, published: String?, to: List = emptyList() - ) : super(add(type, "Note"), name) { - this.id = id + ) : super( + type = add(type, "Note"), + name = name, + id = id + ) { this.attributedTo = attributedTo this.content = content this.published = published diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Object.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Object.kt index 080f21ef..c66e7224 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Object.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Object.kt @@ -10,12 +10,14 @@ open class Object : JsonLd { private var type: List = emptyList() var name: String? = null var actor: String? = null + var id:String? = null protected constructor() - constructor(type: List, name: String? = null,actor:String? = null) : super() { + constructor(type: List, name: String? = null,actor:String? = null,id:String? = null) : super() { this.type = type this.name = name this.actor = actor + this.id = id } companion object { diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Person.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Person.kt index 6fecebc6..8a4e5711 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Person.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Person.kt @@ -1,7 +1,6 @@ package dev.usbharu.hideout.domain.model.ap open class Person : Object { - private var id: String? = null var preferredUsername: String? = null var summary: String? = null var inbox: String? = null @@ -22,8 +21,7 @@ open class Person : Object { url: String?, icon: Image?, publicKey: Key? - ) : super(add(type, "Person"), name) { - this.id = id + ) : super(add(type, "Person"), name,id = id) { this.preferredUsername = preferredUsername this.summary = summary this.inbox = inbox 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 80f0666b..d111f5d9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt @@ -55,7 +55,8 @@ class ActivityPubNoteServiceImpl( jsonLd = Create( name = "Create Note", `object` = note, - actor = note.attributedTo + actor = note.attributedTo, + id = "${Config.configData.url}/create/${postEntity.id}" ) ) }