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
|
@Configuration
|
||||||
class JsonOrFormModelMethodProcessorConfig {
|
class JsonOrFormModelMethodProcessorConfig {
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.springframework.context.annotation.Configuration
|
||||||
import org.springframework.web.filter.CommonsRequestLoggingFilter
|
import org.springframework.web.filter.CommonsRequestLoggingFilter
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
class SpringConfig {
|
class SpringConfig {
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ class Document : Object {
|
||||||
this.url = url
|
this.url = url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other !is Document) return false
|
if (other !is Document) return false
|
||||||
|
@ -43,6 +42,4 @@ class Document : Object {
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "Document(mediaType=$mediaType, url=$url) ${super.toString()}"
|
return "Document(mediaType=$mediaType, url=$url) ${super.toString()}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ open class Note : Object {
|
||||||
this.attachment = attachment
|
this.attachment = attachment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other !is Note) return false
|
if (other !is Note) return false
|
||||||
|
@ -74,6 +73,4 @@ open class Note : Object {
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "Note(attributedTo=$attributedTo, attachment=$attachment, content=$content, published=$published, to=$to, cc=$cc, sensitive=$sensitive, inReplyTo=$inReplyTo) ${super.toString()}"
|
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
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun toString(): String {
|
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)"
|
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)
|
return resolveReplyAndRepost(pairs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun resolveReplyAndRepost(pairs: List<Pair<Status, Long?>>): List<Status> {
|
private fun resolveReplyAndRepost(pairs: List<Pair<Status, Long?>>): List<Status> {
|
||||||
val statuses = pairs.map { it.first }
|
val statuses = pairs.map { it.first }
|
||||||
return pairs
|
return pairs
|
||||||
|
@ -56,25 +55,27 @@ class StatusQueryServiceImpl : StatusQueryService {
|
||||||
.groupBy { it[Posts.id] }
|
.groupBy { it[Posts.id] }
|
||||||
.map { it.value }
|
.map { it.value }
|
||||||
.map {
|
.map {
|
||||||
toStatus(it.first()).copy(mediaAttachments = it.map {
|
toStatus(it.first()).copy(
|
||||||
it.toMedia().let {
|
mediaAttachments = it.map {
|
||||||
MediaAttachment(
|
it.toMedia().let {
|
||||||
it.id.toString(),
|
MediaAttachment(
|
||||||
when (it.type) {
|
it.id.toString(),
|
||||||
FileType.Image -> MediaAttachment.Type.image
|
when (it.type) {
|
||||||
FileType.Video -> MediaAttachment.Type.video
|
FileType.Image -> MediaAttachment.Type.image
|
||||||
FileType.Audio -> MediaAttachment.Type.audio
|
FileType.Video -> MediaAttachment.Type.video
|
||||||
FileType.Unknown -> MediaAttachment.Type.unknown
|
FileType.Audio -> MediaAttachment.Type.audio
|
||||||
},
|
FileType.Unknown -> MediaAttachment.Type.unknown
|
||||||
it.url,
|
},
|
||||||
it.thumbnailUrl,
|
it.url,
|
||||||
it.remoteUrl,
|
it.thumbnailUrl,
|
||||||
"",
|
it.remoteUrl,
|
||||||
it.blurHash,
|
"",
|
||||||
it.url
|
it.blurHash,
|
||||||
)
|
it.url
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}) to it.first()[Posts.repostId]
|
) to it.first()[Posts.repostId]
|
||||||
}
|
}
|
||||||
return resolveReplyAndRepost(pairs)
|
return resolveReplyAndRepost(pairs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,6 @@ object PostsMedia : Table() {
|
||||||
override val primaryKey = PrimaryKey(postId, mediaId)
|
override val primaryKey = PrimaryKey(postId, mediaId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun ResultRow.toPost(): Post {
|
fun ResultRow.toPost(): Post {
|
||||||
return Post.of(
|
return Post.of(
|
||||||
id = this[Posts.id],
|
id = this[Posts.id],
|
||||||
|
|
Loading…
Reference in New Issue