mirror of https://github.com/usbharu/Hideout.git
refactor: 不要になった関数を削除
This commit is contained in:
parent
7a116513b2
commit
a1cf528a59
|
@ -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<Status> {
|
||||
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,
|
||||
|
|
|
@ -9,36 +9,6 @@ interface StatusQueryService {
|
|||
suspend fun findByPostIds(ids: List<Long>): List<Status>
|
||||
suspend fun findByPostIdsWithMediaIds(statusQueries: List<StatusQuery>): List<Status>
|
||||
|
||||
/**
|
||||
* アカウントの投稿一覧を取得します
|
||||
*
|
||||
* @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<Status>
|
||||
|
||||
suspend fun accountsStatus(
|
||||
accountId: Long,
|
||||
onlyMedia: Boolean = false,
|
||||
|
|
|
@ -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<Status>
|
||||
|
||||
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<Status> {
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue