mirror of https://github.com/usbharu/Hideout.git
Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
3bd8cfc02b
commit
63c22627c5
|
@ -15,7 +15,6 @@ class MvcConfigurer(private val jsonOrFormModelMethodProcessor: JsonOrFormModelM
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
class JsonOrFormModelMethodProcessorConfig {
|
||||
@Bean
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.springframework.context.annotation.Configuration
|
|||
import org.springframework.web.filter.CommonsRequestLoggingFilter
|
||||
import java.net.URL
|
||||
|
||||
|
||||
@Configuration
|
||||
class SpringConfig {
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ class Document : Object {
|
|||
this.url = url
|
||||
}
|
||||
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is Document) return false
|
||||
|
@ -43,6 +42,4 @@ class Document : Object {
|
|||
override fun toString(): String {
|
||||
return "Document(mediaType=$mediaType, url=$url) ${super.toString()}"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ open class Note : Object {
|
|||
this.attachment = attachment
|
||||
}
|
||||
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is Note) return false
|
||||
|
@ -74,6 +73,4 @@ open class Note : Object {
|
|||
override fun toString(): String {
|
||||
return "Note(attributedTo=$attributedTo, attachment=$attachment, content=$content, published=$published, to=$to, cc=$cc, sensitive=$sensitive, inReplyTo=$inReplyTo) ${super.toString()}"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ class StatusesRequest {
|
|||
return result
|
||||
}
|
||||
|
||||
|
||||
override fun toString(): String {
|
||||
return "StatusesRequest(status=$status, mediaIds=$media_ids, poll=$poll, inReplyToId=$in_reply_to_id, sensitive=$sensitive, spoilerText=$spoiler_text, visibility=$visibility, language=$language, scheduledAt=$scheduled_at)"
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ class StatusQueryServiceImpl : StatusQueryService {
|
|||
return resolveReplyAndRepost(pairs)
|
||||
}
|
||||
|
||||
|
||||
private fun resolveReplyAndRepost(pairs: List<Pair<Status, Long?>>): List<Status> {
|
||||
val statuses = pairs.map { it.first }
|
||||
return pairs
|
||||
|
@ -56,25 +55,27 @@ class StatusQueryServiceImpl : StatusQueryService {
|
|||
.groupBy { it[Posts.id] }
|
||||
.map { it.value }
|
||||
.map {
|
||||
toStatus(it.first()).copy(mediaAttachments = it.map {
|
||||
it.toMedia().let {
|
||||
MediaAttachment(
|
||||
it.id.toString(),
|
||||
when (it.type) {
|
||||
FileType.Image -> MediaAttachment.Type.image
|
||||
FileType.Video -> MediaAttachment.Type.video
|
||||
FileType.Audio -> MediaAttachment.Type.audio
|
||||
FileType.Unknown -> MediaAttachment.Type.unknown
|
||||
},
|
||||
it.url,
|
||||
it.thumbnailUrl,
|
||||
it.remoteUrl,
|
||||
"",
|
||||
it.blurHash,
|
||||
it.url
|
||||
)
|
||||
toStatus(it.first()).copy(
|
||||
mediaAttachments = it.map {
|
||||
it.toMedia().let {
|
||||
MediaAttachment(
|
||||
it.id.toString(),
|
||||
when (it.type) {
|
||||
FileType.Image -> MediaAttachment.Type.image
|
||||
FileType.Video -> MediaAttachment.Type.video
|
||||
FileType.Audio -> MediaAttachment.Type.audio
|
||||
FileType.Unknown -> MediaAttachment.Type.unknown
|
||||
},
|
||||
it.url,
|
||||
it.thumbnailUrl,
|
||||
it.remoteUrl,
|
||||
"",
|
||||
it.blurHash,
|
||||
it.url
|
||||
)
|
||||
}
|
||||
}
|
||||
}) to it.first()[Posts.repostId]
|
||||
) to it.first()[Posts.repostId]
|
||||
}
|
||||
return resolveReplyAndRepost(pairs)
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@ object PostsMedia : Table() {
|
|||
override val primaryKey = PrimaryKey(postId, mediaId)
|
||||
}
|
||||
|
||||
|
||||
fun ResultRow.toPost(): Post {
|
||||
return Post.of(
|
||||
id = this[Posts.id],
|
||||
|
|
Loading…
Reference in New Issue