diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt index 01dbc17c..b1399777 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt @@ -1,5 +1,6 @@ package dev.usbharu.hideout.activitypub.domain.model +import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import dev.usbharu.hideout.activitypub.domain.model.objects.Object import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer @@ -9,7 +10,7 @@ open class Undo( override val actor: String, override val id: String, @JsonDeserialize(using = ObjectDeserializer::class) - @Suppress("VariableNaming") val `object`: Object, + @JsonProperty("object") val apObject: Object, val published: String ) : Object(add(type, "Undo")), HasId, HasActor { @@ -20,7 +21,7 @@ open class Undo( other as Undo - if (`object` != other.`object`) return false + if (apObject != other.apObject) return false if (published != other.published) return false if (actor != other.actor) return false if (id != other.id) return false @@ -30,7 +31,7 @@ open class Undo( override fun hashCode(): Int { var result = super.hashCode() - result = 31 * result + `object`.hashCode() + result = 31 * result + apObject.hashCode() result = 31 * result + published.hashCode() result = 31 * result + actor.hashCode() result = 31 * result + id.hashCode() @@ -38,5 +39,5 @@ open class Undo( } override fun toString(): String = - "Undo(`object`=$`object`, published=$published, actor='$actor', id='$id') ${super.toString()}" + "Undo(`object`=$apObject, published=$published, actor='$actor', id='$id') ${super.toString()}" } diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApRemoveReactionJobProcessor.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApRemoveReactionJobProcessor.kt index 285670b5..0409b9a0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApRemoveReactionJobProcessor.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/like/ApRemoveReactionJobProcessor.kt @@ -31,7 +31,7 @@ class ApRemoveReactionJobProcessor( param.inbox, Undo( actor = param.actor, - `object` = like, + apObject = like, id = "${applicationConfig.url}/undo/like/${param.id}", published = Instant.now().toString() ), diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APSendUndoServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APSendUndoServiceImpl.kt index 3945cc5a..e1d4c6fd 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APSendUndoServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APSendUndoServiceImpl.kt @@ -22,7 +22,7 @@ class APSendUndoServiceImpl( Undo( actor = user.url, id = "${applicationConfig.url}/undo/follow/${user.id}/${target.url}", - `object` = Follow( + apObject = Follow( apObject = user.url, actor = target.url ), @@ -40,7 +40,7 @@ class APSendUndoServiceImpl( Undo( actor = user.url, id = "${applicationConfig.url}/undo/block/${user.id}/${target.url}", - `object` = Block( + apObject = Block( apObject = user.url, actor = target.url, id = "${applicationConfig.url}/block/${user.id}/${target.id}" diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APUndoProcessor.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APUndoProcessor.kt index 6f44abc6..f6a3ff0e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APUndoProcessor.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/activity/undo/APUndoProcessor.kt @@ -28,13 +28,13 @@ class APUndoProcessor( } val type = - undo.`object`.type.orEmpty() + undo.apObject.type.orEmpty() .firstOrNull { it == "Block" || it == "Follow" || it == "Like" || it == "Announce" || it == "Accept" } ?: return when (type) { "Follow" -> { - val follow = undo.`object` as Follow + val follow = undo.apObject as Follow apUserService.fetchPerson(undo.actor, follow.apObject) val follower = userQueryService.findByUrl(undo.actor)