mirror of https://github.com/usbharu/Hideout.git
Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
55783fefa2
commit
e9e96508ba
|
@ -40,6 +40,4 @@ open class Block(
|
|||
")" +
|
||||
" ${super.toString()}"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,4 @@ open class Reject(
|
|||
")" +
|
||||
" ${super.toString()}"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -32,5 +32,4 @@ class ApSendAcceptServiceImpl(
|
|||
|
||||
jobQueueParentService.scheduleTypeSafe(deliverAcceptJob, deliverAcceptJobParam)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ class APDeliverBlockJobProcessor(
|
|||
private val deliverBlockJob: DeliverBlockJob
|
||||
) : JobProcessor<DeliverBlockJobParam, DeliverBlockJob> {
|
||||
override suspend fun process(param: DeliverBlockJobParam): Unit = transaction.transaction {
|
||||
|
||||
val signer = userRepository.findById(param.signer)
|
||||
apRequestService.apPost(
|
||||
param.inbox,
|
||||
|
|
|
@ -9,7 +9,6 @@ import dev.usbharu.hideout.core.query.UserQueryService
|
|||
import dev.usbharu.hideout.core.service.relationship.RelationshipService
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
|
||||
/**
|
||||
* ブロックアクティビティを処理します
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,6 @@ class ApSendRejectServiceImpl(
|
|||
private val deliverRejectJob: DeliverRejectJob
|
||||
) : ApSendRejectService {
|
||||
override suspend fun sendRejectFollow(user: User, target: User) {
|
||||
|
||||
val deliverRejectJobParam = DeliverRejectJobParam(
|
||||
Reject(
|
||||
user.url,
|
||||
|
|
|
@ -57,7 +57,6 @@ class RelationshipRepositoryImpl : RelationshipRepository {
|
|||
}.singleOrNull()
|
||||
?.toRelationships()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun ResultRow.toRelationships(): Relationship = Relationship(
|
||||
|
|
|
@ -49,6 +49,4 @@ class DeliverBlockJob(@Qualifier("activitypub") private val objectMapper: Object
|
|||
objectMapper.readValue(props[reject]),
|
||||
props[inbox]
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ class FollowerQueryServiceImpl(
|
|||
) : FollowerQueryService {
|
||||
override suspend fun findFollowersById(id: Long): List<User> {
|
||||
return userQueryService.findByIds(
|
||||
relationshipQueryService.findByTargetIdAndFollowing(id, true).map { it.userId })
|
||||
relationshipQueryService.findByTargetIdAndFollowing(id, true).map { it.userId }
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun alreadyFollow(userId: Long, followerId: Long): Boolean =
|
||||
|
|
|
@ -19,5 +19,4 @@ interface RelationshipService {
|
|||
suspend fun unblock(userId: Long, targetId: Long)
|
||||
suspend fun mute(userId: Long, targetId: Long)
|
||||
suspend fun unmute(userId: Long, targetId: Long)
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class RelationshipServiceImpl(
|
|||
val user = userQueryService.findById(userId)
|
||||
apSendFollowService.sendFollow(SendFollowDto(user, remoteUser))
|
||||
} else {
|
||||
//TODO: フォロー許可制ユーザーを実装したら消す
|
||||
// TODO: フォロー許可制ユーザーを実装したら消す
|
||||
acceptFollowRequest(targetId, userId)
|
||||
}
|
||||
|
||||
|
@ -135,12 +135,16 @@ class RelationshipServiceImpl(
|
|||
|
||||
if (relationship.blocking) {
|
||||
logger.warn("FAILED Blocking user userId: {} targetId: {}", userId, targetId)
|
||||
throw IllegalStateException("Cannot accept a follow request from a blocked user. userId: $userId targetId: $targetId")
|
||||
throw IllegalStateException(
|
||||
"Cannot accept a follow request from a blocked user. userId: $userId targetId: $targetId"
|
||||
)
|
||||
}
|
||||
|
||||
if (inverseRelationship.blocking) {
|
||||
logger.warn("FAILED BLocked by user userId: {} targetId: {}", userId, targetId)
|
||||
throw IllegalStateException("Cannot accept a follow request from a blocking user. userId: $userId targetId: $targetId")
|
||||
throw IllegalStateException(
|
||||
"Cannot accept a follow request from a blocking user. userId: $userId targetId: $targetId"
|
||||
)
|
||||
}
|
||||
|
||||
val copy = relationship.copy(followRequest = false, following = true, blocking = false)
|
||||
|
@ -237,7 +241,6 @@ class RelationshipServiceImpl(
|
|||
val copy = relationship.copy(blocking = false)
|
||||
relationshipRepository.save(copy)
|
||||
|
||||
|
||||
val remoteUser = isRemoteUser(targetId)
|
||||
if (remoteUser != null) {
|
||||
val user = userQueryService.findById(userId)
|
||||
|
|
Loading…
Reference in New Issue