refactor: 不要な依存を削除 fix lint

This commit is contained in:
usbharu 2023-12-11 01:47:23 +09:00
parent e9e96508ba
commit c57ba6d434
9 changed files with 40 additions and 48 deletions

View File

@ -10,7 +10,6 @@ import dev.usbharu.hideout.activitypub.service.objects.user.APUserService
import dev.usbharu.hideout.application.external.Transaction import dev.usbharu.hideout.application.external.Transaction
import dev.usbharu.hideout.core.query.UserQueryService import dev.usbharu.hideout.core.query.UserQueryService
import dev.usbharu.hideout.core.service.relationship.RelationshipService import dev.usbharu.hideout.core.service.relationship.RelationshipService
import dev.usbharu.hideout.core.service.user.UserService
import org.springframework.stereotype.Service import org.springframework.stereotype.Service
@Service @Service
@ -18,18 +17,14 @@ class APUndoProcessor(
transaction: Transaction, transaction: Transaction,
private val apUserService: APUserService, private val apUserService: APUserService,
private val userQueryService: UserQueryService, private val userQueryService: UserQueryService,
private val userService: UserService,
private val relationshipService: RelationshipService private val relationshipService: RelationshipService
) : ) :
AbstractActivityPubProcessor<Undo>(transaction) { AbstractActivityPubProcessor<Undo>(transaction) {
override suspend fun internalProcess(activity: ActivityPubProcessContext<Undo>) { override suspend fun internalProcess(activity: ActivityPubProcessContext<Undo>) {
val undo = activity.activity val undo = activity.activity
if (undo.actor == null) {
return
}
val type = val type =
undo.apObject.type.orEmpty() undo.apObject.type
.firstOrNull { it == "Block" || it == "Follow" || it == "Like" || it == "Announce" || it == "Accept" } .firstOrNull { it == "Block" || it == "Follow" || it == "Like" || it == "Announce" || it == "Accept" }
?: return ?: return

View File

@ -60,13 +60,13 @@ class RelationshipRepositoryImpl : RelationshipRepository {
} }
fun ResultRow.toRelationships(): Relationship = Relationship( fun ResultRow.toRelationships(): Relationship = Relationship(
this[Relationships.userId], userId = this[Relationships.userId],
this[Relationships.targetUserId], targetUserId = this[Relationships.targetUserId],
this[Relationships.following], following = this[Relationships.following],
this[Relationships.blocking], blocking = this[Relationships.blocking],
this[Relationships.muting], muting = this[Relationships.muting],
this[Relationships.followRequest], followRequest = this[Relationships.followRequest],
this[Relationships.ignoreFollowRequestFromTarget] ignoreFollowRequestFromTarget = this[Relationships.ignoreFollowRequestFromTarget]
) )
object Relationships : LongIdTable("relationships") { object Relationships : LongIdTable("relationships") {

View File

@ -36,6 +36,7 @@ class KJobJobQueueWorkerService(private val jobQueueProcessorList: List<JobProce
for (jobProcessor in jobQueueProcessorList) { for (jobProcessor in jobQueueProcessorList) {
kjob.register(jobProcessor.job()) { kjob.register(jobProcessor.job()) {
execute { execute {
@Suppress("TooGenericExceptionCaught")
try { try {
MDC.put("x-job-id", this.jobId) MDC.put("x-job-id", this.jobId)
val param = it.convertUnsafe(props) val param = it.convertUnsafe(props)

View File

@ -36,6 +36,7 @@ class LocalFileSystemMediaDataStore(
savePath.createDirectories() savePath.createDirectories()
} }
@Suppress("NestedBlockDepth")
override suspend fun save(dataMediaSave: MediaSave): SavedMedia { override suspend fun save(dataMediaSave: MediaSave): SavedMedia {
val fileSavePath = buildSavePath(savePath, dataMediaSave.name) val fileSavePath = buildSavePath(savePath, dataMediaSave.name)
val thumbnailSavePath = buildSavePath(savePath, "thumbnail-" + dataMediaSave.name) val thumbnailSavePath = buildSavePath(savePath, "thumbnail-" + dataMediaSave.name)

View File

@ -1,10 +1,8 @@
package dev.usbharu.hideout.core.service.user package dev.usbharu.hideout.core.service.user
import dev.usbharu.hideout.activitypub.service.activity.follow.APSendFollowService
import dev.usbharu.hideout.application.config.ApplicationConfig import dev.usbharu.hideout.application.config.ApplicationConfig
import dev.usbharu.hideout.core.domain.model.user.User import dev.usbharu.hideout.core.domain.model.user.User
import dev.usbharu.hideout.core.domain.model.user.UserRepository import dev.usbharu.hideout.core.domain.model.user.UserRepository
import dev.usbharu.hideout.core.query.FollowerQueryService
import dev.usbharu.hideout.core.query.UserQueryService import dev.usbharu.hideout.core.query.UserQueryService
import dev.usbharu.hideout.core.service.instance.InstanceService import dev.usbharu.hideout.core.service.instance.InstanceService
import org.jetbrains.exposed.exceptions.ExposedSQLException import org.jetbrains.exposed.exceptions.ExposedSQLException
@ -17,9 +15,7 @@ import java.time.Instant
class UserServiceImpl( class UserServiceImpl(
private val userRepository: UserRepository, private val userRepository: UserRepository,
private val userAuthService: UserAuthService, private val userAuthService: UserAuthService,
private val apSendFollowService: APSendFollowService,
private val userQueryService: UserQueryService, private val userQueryService: UserQueryService,
private val followerQueryService: FollowerQueryService,
private val userBuilder: User.UserBuilder, private val userBuilder: User.UserBuilder,
private val applicationConfig: ApplicationConfig, private val applicationConfig: ApplicationConfig,
private val instanceService: InstanceService private val instanceService: InstanceService

View File

@ -75,17 +75,17 @@ class MastodonAccountApiController(
val userid = principal.getClaim<String>("uid").toLong() val userid = principal.getClaim<String>("uid").toLong()
val statusFlow = accountApiService.accountsStatuses( val statusFlow = accountApiService.accountsStatuses(
id.toLong(), userid = id.toLong(),
maxId?.toLongOrNull(), maxId = maxId?.toLongOrNull(),
sinceId?.toLongOrNull(), sinceId = sinceId?.toLongOrNull(),
minId?.toLongOrNull(), minId = minId?.toLongOrNull(),
limit, limit = limit,
onlyMedia, onlyMedia = onlyMedia,
excludeReplies, excludeReplies = excludeReplies,
excludeReblogs, excludeReblogs = excludeReblogs,
pinned, pinned = pinned,
tagged, tagged = tagged,
userid loginUser = userid
).asFlow() ).asFlow()
ResponseEntity.ok(statusFlow) ResponseEntity.ok(statusFlow)
} }

View File

@ -13,6 +13,7 @@ import kotlin.math.min
@Service @Service
interface AccountApiService { interface AccountApiService {
@Suppress("LongParameterList")
suspend fun accountsStatuses( suspend fun accountsStatuses(
userid: Long, userid: Long,
maxId: Long?, maxId: Long?,
@ -76,17 +77,17 @@ class AccountApiServiceImpl(
return transaction.transaction { return transaction.transaction {
statusQueryService.accountsStatus( statusQueryService.accountsStatus(
userid, accountId = userid,
maxId, maxId = maxId,
sinceId, sinceId = sinceId,
minId, minId = minId,
limit, limit = limit,
onlyMedia, onlyMedia = onlyMedia,
excludeReplies, excludeReplies = excludeReplies,
excludeReblogs, excludeReblogs = excludeReblogs,
pinned, pinned = pinned,
tagged, tagged = tagged,
canViewFollowers includeFollowers = canViewFollowers
) )
} }
} }

View File

@ -55,12 +55,12 @@ class AppApiServiceImpl(
registeredClientRepository.save(registeredClient) registeredClientRepository.save(registeredClient)
Application( Application(
appsRequest.clientName, name = appsRequest.clientName,
"invalid-vapid-key", vapidKey = "invalid-vapid-key",
appsRequest.website, website = appsRequest.website,
id, clientId = id,
clientSecret, clientSecret = clientSecret,
appsRequest.redirectUris redirectUri = appsRequest.redirectUris
) )
} }
} }

View File

@ -37,8 +37,6 @@ class UserServiceTest {
userRepository, userRepository,
userAuthService, userAuthService,
mock(), mock(),
mock(),
mock(),
userBuilder, userBuilder,
testApplicationConfig, testApplicationConfig,
mock() mock()
@ -68,7 +66,7 @@ class UserServiceTest {
onBlocking { nextId() } doReturn 113345L onBlocking { nextId() } doReturn 113345L
} }
val userService = val userService =
UserServiceImpl(userRepository, mock(), mock(), mock(), mock(), userBuilder, testApplicationConfig, mock()) UserServiceImpl(userRepository, mock(), mock(), userBuilder, testApplicationConfig, mock())
val user = RemoteUserCreateDto( val user = RemoteUserCreateDto(
name = "test", name = "test",
domain = "remote.example.com", domain = "remote.example.com",