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