mirror of https://github.com/usbharu/Hideout.git
refactor: JSONマッピング用のPOJOの変数名を修正
This commit is contained in:
parent
6dead7462e
commit
0071759ee4
|
@ -1,5 +1,6 @@
|
||||||
package dev.usbharu.hideout.activitypub.domain.model
|
package dev.usbharu.hideout.activitypub.domain.model
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
||||||
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
||||||
import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer
|
import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer
|
||||||
|
@ -9,7 +10,7 @@ open class Undo(
|
||||||
override val actor: String,
|
override val actor: String,
|
||||||
override val id: String,
|
override val id: String,
|
||||||
@JsonDeserialize(using = ObjectDeserializer::class)
|
@JsonDeserialize(using = ObjectDeserializer::class)
|
||||||
@Suppress("VariableNaming") val `object`: Object,
|
@JsonProperty("object") val apObject: Object,
|
||||||
val published: String
|
val published: String
|
||||||
) : Object(add(type, "Undo")), HasId, HasActor {
|
) : Object(add(type, "Undo")), HasId, HasActor {
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ open class Undo(
|
||||||
|
|
||||||
other as Undo
|
other as Undo
|
||||||
|
|
||||||
if (`object` != other.`object`) return false
|
if (apObject != other.apObject) return false
|
||||||
if (published != other.published) return false
|
if (published != other.published) return false
|
||||||
if (actor != other.actor) return false
|
if (actor != other.actor) return false
|
||||||
if (id != other.id) return false
|
if (id != other.id) return false
|
||||||
|
@ -30,7 +31,7 @@ open class Undo(
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = super.hashCode()
|
var result = super.hashCode()
|
||||||
result = 31 * result + `object`.hashCode()
|
result = 31 * result + apObject.hashCode()
|
||||||
result = 31 * result + published.hashCode()
|
result = 31 * result + published.hashCode()
|
||||||
result = 31 * result + actor.hashCode()
|
result = 31 * result + actor.hashCode()
|
||||||
result = 31 * result + id.hashCode()
|
result = 31 * result + id.hashCode()
|
||||||
|
@ -38,5 +39,5 @@ open class Undo(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String =
|
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()}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class ApRemoveReactionJobProcessor(
|
||||||
param.inbox,
|
param.inbox,
|
||||||
Undo(
|
Undo(
|
||||||
actor = param.actor,
|
actor = param.actor,
|
||||||
`object` = like,
|
apObject = like,
|
||||||
id = "${applicationConfig.url}/undo/like/${param.id}",
|
id = "${applicationConfig.url}/undo/like/${param.id}",
|
||||||
published = Instant.now().toString()
|
published = Instant.now().toString()
|
||||||
),
|
),
|
||||||
|
|
|
@ -22,7 +22,7 @@ class APSendUndoServiceImpl(
|
||||||
Undo(
|
Undo(
|
||||||
actor = user.url,
|
actor = user.url,
|
||||||
id = "${applicationConfig.url}/undo/follow/${user.id}/${target.url}",
|
id = "${applicationConfig.url}/undo/follow/${user.id}/${target.url}",
|
||||||
`object` = Follow(
|
apObject = Follow(
|
||||||
apObject = user.url,
|
apObject = user.url,
|
||||||
actor = target.url
|
actor = target.url
|
||||||
),
|
),
|
||||||
|
@ -40,7 +40,7 @@ class APSendUndoServiceImpl(
|
||||||
Undo(
|
Undo(
|
||||||
actor = user.url,
|
actor = user.url,
|
||||||
id = "${applicationConfig.url}/undo/block/${user.id}/${target.url}",
|
id = "${applicationConfig.url}/undo/block/${user.id}/${target.url}",
|
||||||
`object` = Block(
|
apObject = Block(
|
||||||
apObject = user.url,
|
apObject = user.url,
|
||||||
actor = target.url,
|
actor = target.url,
|
||||||
id = "${applicationConfig.url}/block/${user.id}/${target.id}"
|
id = "${applicationConfig.url}/block/${user.id}/${target.id}"
|
||||||
|
|
|
@ -28,13 +28,13 @@ class APUndoProcessor(
|
||||||
}
|
}
|
||||||
|
|
||||||
val type =
|
val type =
|
||||||
undo.`object`.type.orEmpty()
|
undo.apObject.type.orEmpty()
|
||||||
.firstOrNull { it == "Block" || it == "Follow" || it == "Like" || it == "Announce" || it == "Accept" }
|
.firstOrNull { it == "Block" || it == "Follow" || it == "Like" || it == "Announce" || it == "Accept" }
|
||||||
?: return
|
?: return
|
||||||
|
|
||||||
when (type) {
|
when (type) {
|
||||||
"Follow" -> {
|
"Follow" -> {
|
||||||
val follow = undo.`object` as Follow
|
val follow = undo.apObject as Follow
|
||||||
|
|
||||||
apUserService.fetchPerson(undo.actor, follow.apObject)
|
apUserService.fetchPerson(undo.actor, follow.apObject)
|
||||||
val follower = userQueryService.findByUrl(undo.actor)
|
val follower = userQueryService.findByUrl(undo.actor)
|
||||||
|
|
Loading…
Reference in New Issue