diff --git a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepository.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepository.kt index fa6666c4..a80b7132 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepository.kt @@ -36,16 +36,6 @@ interface RelationshipRepository { suspend fun findByTargetIdAndFollowing(targetId: Long, following: Boolean): List - @Suppress("LongParameterList", "FunctionMaxLength") - suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest( - maxId: Long?, - sinceId: Long?, - limit: Int, - targetId: Long, - followRequest: Boolean, - ignoreFollowRequest: Boolean - ): List - suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest( targetIdLong: Long, followRequest: Boolean, @@ -53,15 +43,6 @@ interface RelationshipRepository { page: Page.PageByMaxId ): PaginationList - @Suppress("FunctionMaxLength") - suspend fun findByActorIdAntMutingAndMaxIdAndSinceId( - actorId: Long, - muting: Boolean, - maxId: Long?, - sinceId: Long?, - limit: Int - ): List - suspend fun findByActorIdAndMuting( actorId: Long, muting: Boolean, diff --git a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepositoryImpl.kt index b2aa6bd5..5ee4c5f1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/relationship/RelationshipRepositoryImpl.kt @@ -76,30 +76,6 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository() .map { it.toRelationships() } } - override suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest( - maxId: Long?, - sinceId: Long?, - limit: Int, - targetId: Long, - followRequest: Boolean, - ignoreFollowRequest: Boolean - ): List = query { - val query = Relationships.select { - Relationships.targetActorId.eq(targetId).and(Relationships.followRequest.eq(followRequest)) - .and(Relationships.ignoreFollowRequestFromTarget.eq(ignoreFollowRequest)) - }.limit(limit) - - if (maxId != null) { - query.andWhere { Relationships.id lessEq maxId } - } - - if (sinceId != null) { - query.andWhere { Relationships.id greaterEq sinceId } - } - - return@query query.map { it.toRelationships() } - } - override suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest( targetId: Long, followRequest: Boolean, @@ -120,28 +96,6 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository() ) } - override suspend fun findByActorIdAntMutingAndMaxIdAndSinceId( - actorId: Long, - muting: Boolean, - maxId: Long?, - sinceId: Long?, - limit: Int - ): List = query { - val query = Relationships.select { - Relationships.actorId.eq(actorId).and(Relationships.muting.eq(muting)) - }.limit(limit) - - if (maxId != null) { - query.andWhere { Relationships.id lessEq maxId } - } - - if (sinceId != null) { - query.andWhere { Relationships.id greaterEq sinceId } - } - - return@query query.map { it.toRelationships() } - } - override suspend fun findByActorIdAndMuting( actorId: Long, muting: Boolean, diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountApiService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountApiService.kt index 3139576e..5357effb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/account/AccountApiService.kt @@ -52,13 +52,6 @@ interface AccountApiService { suspend fun unfollow(userid: Long, target: Long): Relationship suspend fun removeFromFollowers(userid: Long, target: Long): Relationship suspend fun updateProfile(userid: Long, updateCredentials: UpdateCredentials?): Account - suspend fun followRequests( - loginUser: Long, - maxId: Long?, - sinceId: Long?, - limit: Int = 20, - withIgnore: Boolean - ): List suspend fun followRequests( loginUser: Long, @@ -70,7 +63,6 @@ interface AccountApiService { suspend fun rejectFollowRequest(loginUser: Long, target: Long): Relationship suspend fun mute(userid: Long, target: Long): Relationship suspend fun unmute(userid: Long, target: Long): Relationship - suspend fun mutesAccount(userid: Long, maxId: Long?, sinceId: Long?, limit: Int): List suspend fun mutesAccount(userid: Long, pageByMaxId: Page.PageByMaxId): PaginationList } @@ -224,27 +216,6 @@ class AccountApiServiceImpl( accountService.findById(userid) } - override suspend fun followRequests( - loginUser: Long, - maxId: Long?, - sinceId: Long?, - limit: Int, - withIgnore: Boolean - ): List = transaction.transaction { - val actorIdList = relationshipRepository - .findByTargetIdAndFollowRequestAndIgnoreFollowRequest( - maxId = maxId, - sinceId = sinceId, - limit = limit, - targetId = loginUser, - followRequest = true, - ignoreFollowRequest = withIgnore - ) - .map { it.actorId } - - return@transaction accountService.findByIds(actorIdList) - } - override suspend fun followRequests( loginUser: Long, withIgnore: Boolean, @@ -286,13 +257,6 @@ class AccountApiServiceImpl( return@transaction fetchRelationship(userid, target) } - override suspend fun mutesAccount(userid: Long, maxId: Long?, sinceId: Long?, limit: Int): List { - val mutedAccounts = - relationshipRepository.findByActorIdAntMutingAndMaxIdAndSinceId(userid, true, maxId, sinceId, limit) - - return accountService.findByIds(mutedAccounts.map { it.targetActorId }) - } - override suspend fun mutesAccount(userid: Long, pageByMaxId: Page.PageByMaxId): PaginationList { val mutedAccounts = relationshipRepository.findByActorIdAndMuting(userid, true, pageByMaxId)