Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
usbharu 2023-12-11 01:34:21 +09:00 committed by GitHub
parent 55783fefa2
commit e9e96508ba
13 changed files with 31 additions and 39 deletions

View File

@ -40,6 +40,4 @@ open class Block(
")" +
" ${super.toString()}"
}
}

View File

@ -40,6 +40,4 @@ open class Reject(
")" +
" ${super.toString()}"
}
}

View File

@ -32,5 +32,4 @@ class ApSendAcceptServiceImpl(
jobQueueParentService.scheduleTypeSafe(deliverAcceptJob, deliverAcceptJobParam)
}
}

View File

@ -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,

View File

@ -9,7 +9,6 @@ import dev.usbharu.hideout.core.query.UserQueryService
import dev.usbharu.hideout.core.service.relationship.RelationshipService
import org.springframework.stereotype.Service
/**
* ブロックアクティビティを処理します
*/

View File

@ -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,

View File

@ -57,7 +57,6 @@ class RelationshipRepositoryImpl : RelationshipRepository {
}.singleOrNull()
?.toRelationships()
}
}
fun ResultRow.toRelationships(): Relationship = Relationship(

View File

@ -49,6 +49,4 @@ class DeliverBlockJob(@Qualifier("activitypub") private val objectMapper: Object
objectMapper.readValue(props[reject]),
props[inbox]
)
}

View File

@ -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 =

View File

@ -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)
}

View File

@ -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)