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-14 01:13:16 +09:00 committed by GitHub
parent bdd69d258c
commit 53d195bd8d
4 changed files with 18 additions and 23 deletions

View File

@ -72,7 +72,7 @@ class PostServiceImpl(
postQueryService.findByActorId(actorId).filterNot { it.delted }.forEach { postRepository.save(it.delete()) } postQueryService.findByActorId(actorId).filterNot { it.delted }.forEach { postRepository.save(it.delete()) }
val actor = actorRepository.findById(actorId) val actor = actorRepository.findById(actorId)
?: throw IllegalStateException("actor: ${actorId} was not found.") ?: throw IllegalStateException("actor: $actorId was not found.")
actorRepository.save(actor.copy(postsCount = 0, lastPostDate = null)) actorRepository.save(actor.copy(postsCount = 0, lastPostDate = null))
} }

View File

@ -113,8 +113,6 @@ class RelationshipServiceImpl(
val inverseRelationship = relationshipRepository.findByUserIdAndTargetUserId(targetId, actorId) val inverseRelationship = relationshipRepository.findByUserIdAndTargetUserId(targetId, actorId)
if (inverseRelationship?.following == true) { if (inverseRelationship?.following == true) {
actorRepository.save(targetActor.decrementFollowing()) actorRepository.save(targetActor.decrementFollowing())
actorRepository.save(user.decrementFollowers()) actorRepository.save(user.decrementFollowers())
@ -131,7 +129,6 @@ class RelationshipServiceImpl(
val remoteUser = isRemoteUser(targetId) val remoteUser = isRemoteUser(targetId)
if (remoteUser != null) { if (remoteUser != null) {
apSendBlockService.sendBlock(user, remoteUser) apSendBlockService.sendBlock(user, remoteUser)
} }
} }
@ -261,7 +258,6 @@ class RelationshipServiceImpl(
val remoteUser = isRemoteUser(targetId) val remoteUser = isRemoteUser(targetId)
if (remoteUser != null) { if (remoteUser != null) {
apSendUndoService.sendUndoFollow(user, remoteUser) apSendUndoService.sendUndoFollow(user, remoteUser)
} }
} }

View File

@ -14,7 +14,6 @@ import java.time.Instant
@Repository @Repository
class AccountQueryServiceImpl(private val applicationConfig: ApplicationConfig) : AccountQueryService { class AccountQueryServiceImpl(private val applicationConfig: ApplicationConfig) : AccountQueryService {
override suspend fun findById(accountId: Long): Account { override suspend fun findById(accountId: Long): Account {
val query = Actors.select { Actors.id eq accountId } val query = Actors.select { Actors.id eq accountId }
return query return query