fix: 間違えてNoteを直接送りつけていたのでCreateを送りつけるように

This commit is contained in:
usbharu 2023-04-21 21:43:20 +09:00
parent 3e81eb78f7
commit dcbfe96f0d
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,30 @@
package dev.usbharu.hideout.domain.model.ap
open class Create : Object {
var `object` : Object? = null
protected constructor() : super()
constructor(type: List<String> = emptyList(), name: String, `object`: Object?) : super(add(type,"Create"), name) {
this.`object` = `object`
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is Create) return false
if (!super.equals(other)) return false
return `object` == other.`object`
}
override fun hashCode(): Int {
var result = super.hashCode()
result = 31 * result + (`object`?.hashCode() ?: 0)
return result
}
override fun toString(): String {
return "Create(`object`=$`object`) ${super.toString()}"
}
}

View File

@ -3,6 +3,7 @@ package dev.usbharu.hideout.service.activitypub
import com.fasterxml.jackson.module.kotlin.readValue
import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.domain.model.PostEntity
import dev.usbharu.hideout.domain.model.ap.Create
import dev.usbharu.hideout.domain.model.ap.Note
import dev.usbharu.hideout.domain.model.job.DeliverPostJob
import dev.usbharu.hideout.plugins.postAp
@ -51,7 +52,10 @@ class ActivityPubNoteServiceImpl(
httpClient.postAp(
urlString = inbox,
username = "$actor#pubkey",
jsonLd = note
jsonLd = Create(
name = "Create Note",
`object` = note
)
)
}
}