mirror of https://github.com/usbharu/Hideout.git
style: fix lint
This commit is contained in:
parent
a0b434b023
commit
f0a3251ea1
|
@ -154,6 +154,9 @@ performance:
|
|||
UnnecessaryTemporaryInstantiation:
|
||||
active: true
|
||||
|
||||
SpreadOperator:
|
||||
active: false
|
||||
|
||||
potential-bugs:
|
||||
CastToNullableType:
|
||||
active: true
|
||||
|
|
|
@ -21,6 +21,7 @@ constructor(
|
|||
val manuallyApprovesFollowers: Boolean? = false
|
||||
) : Object(add(type, "Person")), HasId, HasName {
|
||||
|
||||
@Suppress("CyclomaticComplexMethod", "CognitiveComplexMethod")
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
@ -45,6 +46,7 @@ constructor(
|
|||
return true
|
||||
}
|
||||
|
||||
@Suppress("CyclomaticComplexMethod")
|
||||
override fun hashCode(): Int {
|
||||
var result = super.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
|
|
|
@ -27,7 +27,7 @@ class UserDetailsServiceImpl(
|
|||
val findById = try {
|
||||
actorQueryService.findByNameAndDomain(username, applicationConfig.url.host)
|
||||
} catch (e: FailedToGetResourcesException) {
|
||||
throw UsernameNotFoundException("$username not found")
|
||||
throw UsernameNotFoundException("$username not found", e)
|
||||
}
|
||||
val userDetails = userDetailRepository.findByActorId(findById.id)
|
||||
?: throw UsernameNotFoundException("${findById.id} not found.")
|
||||
|
|
|
@ -5,6 +5,8 @@ import dev.usbharu.hideout.core.domain.model.relationship.Relationship
|
|||
interface RelationshipQueryService {
|
||||
|
||||
suspend fun findByTargetIdAndFollowing(targetId: Long, following: Boolean): List<Relationship>
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest(
|
||||
maxId: Long?,
|
||||
sinceId: Long?,
|
||||
|
|
|
@ -73,7 +73,6 @@ class RelationshipServiceImpl(
|
|||
|
||||
relationshipRepository.save(relationship)
|
||||
|
||||
|
||||
val remoteUser = isRemoteUser(targetId)
|
||||
|
||||
if (remoteUser != null) {
|
||||
|
|
|
@ -32,7 +32,11 @@ class AccountQueryServiceImpl(private val applicationConfig: ApplicationConfig)
|
|||
lastCreated,
|
||||
postsCount
|
||||
)
|
||||
.select { Actors.id eq accountId and (Relationships.following eq true or (Relationships.following.isNull())) }
|
||||
.select {
|
||||
(Actors.id.eq(accountId)).and(
|
||||
Relationships.following.eq(true).or(Relationships.following.isNull())
|
||||
)
|
||||
}
|
||||
.groupBy(Actors.id)
|
||||
|
||||
return query
|
||||
|
@ -57,7 +61,10 @@ class AccountQueryServiceImpl(private val applicationConfig: ApplicationConfig)
|
|||
lastCreated,
|
||||
postsCount
|
||||
)
|
||||
.select { Actors.id inList accountIds and (Relationships.following eq true or (Relationships.following.isNull())) }
|
||||
.select {
|
||||
Actors.id.inList(accountIds)
|
||||
.and(Relationships.following.eq(true).or(Relationships.following.isNull()))
|
||||
}
|
||||
.groupBy(Actors.id)
|
||||
|
||||
return query
|
||||
|
|
|
@ -144,7 +144,8 @@ class MastodonAccountApiController(
|
|||
return ResponseEntity.ok(removeFromFollowers)
|
||||
}
|
||||
|
||||
override suspend fun apiV1AccountsUpdateCredentialsPatch(updateCredentials: UpdateCredentials?): ResponseEntity<Account> {
|
||||
override suspend fun apiV1AccountsUpdateCredentialsPatch(updateCredentials: UpdateCredentials?):
|
||||
ResponseEntity<Account> {
|
||||
val principal = SecurityContextHolder.getContext().getAuthentication().principal as Jwt
|
||||
|
||||
val userid = principal.getClaim<String>("uid").toLong()
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Service
|
|||
import kotlin.math.min
|
||||
|
||||
@Service
|
||||
@Suppress("TooManyFunctions")
|
||||
interface AccountApiService {
|
||||
@Suppress("LongParameterList")
|
||||
suspend fun accountsStatuses(
|
||||
|
|
|
@ -14,11 +14,7 @@ interface AccountService {
|
|||
class AccountServiceImpl(
|
||||
private val accountQueryService: AccountQueryService
|
||||
) : AccountService {
|
||||
override suspend fun findById(id: Long): Account {
|
||||
return accountQueryService.findById(id)
|
||||
}
|
||||
override suspend fun findById(id: Long): Account = accountQueryService.findById(id)
|
||||
|
||||
override suspend fun findByIds(ids: List<Long>): List<Account> {
|
||||
return accountQueryService.findByIds(ids)
|
||||
}
|
||||
override suspend fun findByIds(ids: List<Long>): List<Account> = accountQueryService.findByIds(ids)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue