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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,8 @@
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.core.domain.model.user.User
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.service.instance.InstanceService
import org.jetbrains.exposed.exceptions.ExposedSQLException
@ -17,9 +15,7 @@ import java.time.Instant
class UserServiceImpl(
private val userRepository: UserRepository,
private val userAuthService: UserAuthService,
private val apSendFollowService: APSendFollowService,
private val userQueryService: UserQueryService,
private val followerQueryService: FollowerQueryService,
private val userBuilder: User.UserBuilder,
private val applicationConfig: ApplicationConfig,
private val instanceService: InstanceService

View File

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

View File

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

View File

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

View File

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