mirror of https://github.com/usbharu/Hideout.git
feat: Followアクティビティにidを追加
This commit is contained in:
parent
c1e1a4d963
commit
5e6843e883
|
@ -6,12 +6,12 @@ import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
||||||
open class Follow(
|
open class Follow(
|
||||||
type: List<String> = emptyList(),
|
type: List<String> = emptyList(),
|
||||||
@JsonProperty("object") val apObject: String,
|
@JsonProperty("object") val apObject: String,
|
||||||
override val actor: String
|
override val actor: String,
|
||||||
|
val id: String? = null
|
||||||
) : Object(
|
) : Object(
|
||||||
type = add(type, "Follow")
|
type = add(type, "Follow")
|
||||||
),
|
),
|
||||||
HasActor {
|
HasActor {
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (javaClass != other?.javaClass) return false
|
if (javaClass != other?.javaClass) return false
|
||||||
|
@ -21,6 +21,7 @@ open class Follow(
|
||||||
|
|
||||||
if (apObject != other.apObject) return false
|
if (apObject != other.apObject) return false
|
||||||
if (actor != other.actor) return false
|
if (actor != other.actor) return false
|
||||||
|
if (id != other.id) return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -29,14 +30,11 @@ open class Follow(
|
||||||
var result = super.hashCode()
|
var result = super.hashCode()
|
||||||
result = 31 * result + apObject.hashCode()
|
result = 31 * result + apObject.hashCode()
|
||||||
result = 31 * result + actor.hashCode()
|
result = 31 * result + actor.hashCode()
|
||||||
|
result = 31 * result + (id?.hashCode() ?: 0)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "Follow(" +
|
return "Follow(apObject='$apObject', actor='$actor', id=$id)"
|
||||||
"apObject='$apObject', " +
|
|
||||||
"actor='$actor'" +
|
|
||||||
")" +
|
|
||||||
" ${super.toString()}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package dev.usbharu.hideout.activitypub.service.activity.follow
|
||||||
|
|
||||||
import dev.usbharu.hideout.activitypub.domain.model.Follow
|
import dev.usbharu.hideout.activitypub.domain.model.Follow
|
||||||
import dev.usbharu.hideout.activitypub.service.common.APRequestService
|
import dev.usbharu.hideout.activitypub.service.common.APRequestService
|
||||||
|
import dev.usbharu.hideout.application.config.ApplicationConfig
|
||||||
import dev.usbharu.hideout.core.service.follow.SendFollowDto
|
import dev.usbharu.hideout.core.service.follow.SendFollowDto
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@ -12,11 +13,13 @@ interface APSendFollowService {
|
||||||
@Service
|
@Service
|
||||||
class APSendFollowServiceImpl(
|
class APSendFollowServiceImpl(
|
||||||
private val apRequestService: APRequestService,
|
private val apRequestService: APRequestService,
|
||||||
|
private val applicationConfig: ApplicationConfig,
|
||||||
) : APSendFollowService {
|
) : APSendFollowService {
|
||||||
override suspend fun sendFollow(sendFollowDto: SendFollowDto) {
|
override suspend fun sendFollow(sendFollowDto: SendFollowDto) {
|
||||||
val follow = Follow(
|
val follow = Follow(
|
||||||
apObject = sendFollowDto.followTargetActorId.url,
|
apObject = sendFollowDto.followTargetActorId.url,
|
||||||
actor = sendFollowDto.actorId.url
|
actor = sendFollowDto.actorId.url,
|
||||||
|
id = "${applicationConfig.url}/follow/${sendFollowDto.actorId.id}/${sendFollowDto.followTargetActorId.id}"
|
||||||
)
|
)
|
||||||
|
|
||||||
apRequestService.apPost(sendFollowDto.followTargetActorId.inbox, follow, sendFollowDto.actorId)
|
apRequestService.apPost(sendFollowDto.followTargetActorId.inbox, follow, sendFollowDto.actorId)
|
||||||
|
|
Loading…
Reference in New Issue