From 5acce0051e68e0608d03f0c4a363aa98f5438972 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 20 Oct 2023 12:21:52 +0900 Subject: [PATCH] =?UTF-8?q?style:=20=E3=82=B9=E3=82=BF=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/usbharu/hideout/config/SecurityConfig.kt | 7 +++---- .../mastodon/MastodonStatusesApiContoller.kt | 2 -- .../hideout/domain/model/hideout/entity/User.kt | 10 ++++++---- .../dev/usbharu/hideout/service/ap/APNoteService.kt | 2 -- .../hideout/service/ap/APNoteServiceImplTest.kt | 10 ++++------ 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/config/SecurityConfig.kt b/src/main/kotlin/dev/usbharu/hideout/config/SecurityConfig.kt index 9d6196d8..841abf53 100644 --- a/src/main/kotlin/dev/usbharu/hideout/config/SecurityConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/config/SecurityConfig.kt @@ -56,16 +56,15 @@ import java.util.* @EnableWebSecurity(debug = false) @Configuration -@Suppress("FunctionMaxLength") +@Suppress("FunctionMaxLength", "TooManyFunctions") class SecurityConfig { @Autowired private lateinit var userQueryService: UserQueryService @Bean - fun authenticationManager(authenticationConfiguration: AuthenticationConfiguration): AuthenticationManager? { - return authenticationConfiguration.authenticationManager - } + fun authenticationManager(authenticationConfiguration: AuthenticationConfiguration): AuthenticationManager? = + authenticationConfiguration.authenticationManager @Bean @Order(1) diff --git a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonStatusesApiContoller.kt b/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonStatusesApiContoller.kt index 796894ae..02737c71 100644 --- a/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonStatusesApiContoller.kt +++ b/src/main/kotlin/dev/usbharu/hideout/controller/mastodon/MastodonStatusesApiContoller.kt @@ -15,7 +15,6 @@ class MastodonStatusesApiContoller(private val statusesApiService: StatusesApiSe override suspend fun apiV1StatusesPost( devUsbharuHideoutDomainModelMastodonStatusesRequest: StatusesRequest ): ResponseEntity { - val jwt = SecurityContextHolder.getContext().authentication.principal as Jwt return ResponseEntity( @@ -25,6 +24,5 @@ class MastodonStatusesApiContoller(private val statusesApiService: StatusesApiSe ), HttpStatus.OK ) - } } diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt index 2beed536..d79d617b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/hideout/entity/User.kt @@ -21,15 +21,17 @@ data class User private constructor( val followers: String? = null, val following: String? = null ) { - override fun toString(): String { - return "User(id=$id, name='$name', domain='$domain', screenName='$screenName', description='$description', password=$password, inbox='$inbox', outbox='$outbox', url='$url', publicKey='$publicKey', privateKey=$privateKey, createdAt=$createdAt, keyId='$keyId', followers=$followers, following=$following)" - } + override fun toString(): String = + "User(id=$id, name='$name', domain='$domain', screenName='$screenName', description='$description'," + + " password=$password, inbox='$inbox', outbox='$outbox', url='$url', publicKey='$publicKey'," + + " privateKey=$privateKey, createdAt=$createdAt, keyId='$keyId', followers=$followers," + + " following=$following)" companion object { private val logger = LoggerFactory.getLogger(User::class.java) - @Suppress("LongParameterList", "FunctionMinLength") + @Suppress("LongParameterList", "FunctionMinLength", "LongMethod") fun of( id: Long, name: String, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt index a989af78..6fbe6583 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt @@ -23,7 +23,6 @@ import dev.usbharu.hideout.service.core.Transaction import dev.usbharu.hideout.service.job.JobQueueParentService import dev.usbharu.hideout.service.post.PostCreateInterceptor import dev.usbharu.hideout.service.post.PostService -import io.ktor.client.* import io.ktor.client.plugins.* import kjob.core.job.JobProps import kotlinx.coroutines.CoroutineScope @@ -58,7 +57,6 @@ interface APNoteService { @Service @Suppress("LongParameterList") class APNoteServiceImpl( - private val httpClient: HttpClient, private val jobQueueParentService: JobQueueParentService, private val postRepository: PostRepository, private val apUserService: APUserService, diff --git a/src/test/kotlin/dev/usbharu/hideout/service/ap/APNoteServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/ap/APNoteServiceImplTest.kt index bf3b82d5..2543c8e9 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/ap/APNoteServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/ap/APNoteServiceImplTest.kt @@ -89,17 +89,16 @@ class APNoteServiceImplTest { val jobQueueParentService = mock() val activityPubNoteService = APNoteServiceImpl( - httpClient = mock(), jobQueueParentService = jobQueueParentService, postRepository = mock(), apUserService = mock(), userQueryService = userQueryService, followerQueryService = followerQueryService, postQueryService = mock(), + mediaQueryService = mediaQueryService, objectMapper = objectMapper, applicationConfig = testApplicationConfig, postService = mock(), - mediaQueryService = mediaQueryService, apResourceResolveService = mock(), apRequestService = mock(), transaction = mock() @@ -132,20 +131,19 @@ class APNoteServiceImplTest { } ) val activityPubNoteService = APNoteServiceImpl( - httpClient = httpClient, jobQueueParentService = mock(), postRepository = mock(), apUserService = mock(), userQueryService = mock(), followerQueryService = mock(), postQueryService = mock(), + mediaQueryService = mediaQueryService, objectMapper = objectMapper, applicationConfig = testApplicationConfig, postService = mock(), - mediaQueryService = mediaQueryService, apResourceResolveService = mock(), - transaction = mock(), - apRequestService = mock() + apRequestService = mock(), + transaction = mock() ) activityPubNoteService.createNoteJob( JobProps(