diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt index 1db8bec2..de7bd9ea 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/exposedquery/StatusQueryServiceImpl.kt @@ -55,62 +55,6 @@ class StatusQueryServiceImpl : StatusQueryService { } } - override suspend fun accountsStatus( - accountId: Long, - maxId: Long?, - sinceId: Long?, - minId: Long?, - limit: Int, - onlyMedia: Boolean, - excludeReplies: Boolean, - excludeReblogs: Boolean, - pinned: Boolean, - tagged: String?, - includeFollowers: Boolean - ): List { - val query = Posts - .leftJoin(PostsMedia) - .leftJoin(Actors) - .leftJoin(Media) - .select { Posts.actorId eq accountId }.limit(20) - - if (maxId != null) { - query.andWhere { Posts.id eq maxId } - } - if (sinceId != null) { - query.andWhere { Posts.id eq sinceId } - } - if (minId != null) { - query.andWhere { Posts.id eq minId } - } - if (onlyMedia) { - query.andWhere { PostsMedia.mediaId.isNotNull() } - } - if (excludeReplies) { - query.andWhere { Posts.replyId.isNotNull() } - } - if (excludeReblogs) { - query.andWhere { Posts.repostId.isNotNull() } - } - if (includeFollowers) { - query.andWhere { Posts.visibility inList listOf(public.ordinal, unlisted.ordinal, private.ordinal) } - } else { - query.andWhere { Posts.visibility inList listOf(public.ordinal, unlisted.ordinal) } - } - - val pairs = query.groupBy { it[Posts.id] } - .map { it.value } - .map { - toStatus(it.first()).copy( - mediaAttachments = it.mapNotNull { resultRow -> - resultRow.toMediaOrNull()?.toMediaAttachments() - } - ) to it.first()[Posts.repostId] - } - - return resolveReplyAndRepost(pairs) - } - override suspend fun accountsStatus( accountId: Long, onlyMedia: Boolean, diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/query/StatusQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/query/StatusQueryService.kt index 39869beb..c17a49a7 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/query/StatusQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/query/StatusQueryService.kt @@ -9,36 +9,6 @@ interface StatusQueryService { suspend fun findByPostIds(ids: List): List suspend fun findByPostIdsWithMediaIds(statusQueries: List): List - /** - * アカウントの投稿一覧を取得します - * - * @param accountId 対象アカウントのid - * @param maxId 投稿の最大id - * @param sinceId 投稿の最小id - * @param minId 不明 - * @param limit 投稿の最大件数 - * @param onlyMedia メディア付き投稿のみ - * @param excludeReplies 返信を除外 - * @param excludeReblogs リブログを除外 - * @param pinned ピン止め投稿のみ - * @param tagged タグ付き? - * @param includeFollowers フォロワー限定投稿を含める - */ - @Suppress("LongParameterList") - suspend fun accountsStatus( - accountId: Long, - maxId: Long? = null, - sinceId: Long? = null, - minId: Long? = null, - limit: Int, - onlyMedia: Boolean = false, - excludeReplies: Boolean = false, - excludeReblogs: Boolean = false, - pinned: Boolean = false, - tagged: String? = null, - includeFollowers: Boolean = false - ): List - suspend fun accountsStatus( accountId: Long, onlyMedia: Boolean = false, 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 7aef09cd..68c2781c 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 @@ -19,20 +19,6 @@ import kotlin.math.min @Service @Suppress("TooManyFunctions") interface AccountApiService { - @Suppress("LongParameterList") - suspend fun accountsStatuses( - userid: Long, - maxId: Long?, - sinceId: Long?, - minId: Long?, - limit: Int, - onlyMedia: Boolean, - excludeReplies: Boolean, - excludeReblogs: Boolean, - pinned: Boolean, - tagged: String?, - loginUser: Long? - ): List suspend fun accountsStatuses( userid: Long, @@ -88,43 +74,6 @@ class AccountApiServiceImpl( private val mediaService: MediaService ) : AccountApiService { - override suspend fun accountsStatuses( - userid: Long, - maxId: Long?, - sinceId: Long?, - minId: Long?, - limit: Int, - onlyMedia: Boolean, - excludeReplies: Boolean, - excludeReblogs: Boolean, - pinned: Boolean, - tagged: String?, - loginUser: Long? - ): List { - val canViewFollowers = if (loginUser == null) { - false - } else { - transaction.transaction { - isFollowing(loginUser, userid) - } - } - - return transaction.transaction { - statusQueryService.accountsStatus( - accountId = userid, - maxId = maxId, - sinceId = sinceId, - minId = minId, - limit = limit, - onlyMedia = onlyMedia, - excludeReplies = excludeReplies, - excludeReblogs = excludeReblogs, - pinned = pinned, - tagged = tagged, - includeFollowers = canViewFollowers - ) - } - } override suspend fun accountsStatuses( userid: Long,