mirror of https://github.com/usbharu/Hideout.git
feat: Note中のHTMLをPostBuilderにいれる準備
This commit is contained in:
parent
a4865be4a7
commit
20012782b7
|
@ -128,7 +128,7 @@ class APNoteServiceImpl(
|
|||
postBuilder.of(
|
||||
id = postRepository.generateId(),
|
||||
actorId = person.second.id,
|
||||
text = note.content,
|
||||
content = note.content,
|
||||
createdAt = Instant.parse(note.published).toEpochMilli(),
|
||||
visibility = visibility,
|
||||
url = note.id,
|
||||
|
|
|
@ -8,6 +8,7 @@ data class Post private constructor(
|
|||
val id: Long,
|
||||
val actorId: Long,
|
||||
val overview: String? = null,
|
||||
val content: String,
|
||||
val text: String,
|
||||
val createdAt: Long,
|
||||
val visibility: Visibility,
|
||||
|
@ -28,7 +29,7 @@ data class Post private constructor(
|
|||
id: Long,
|
||||
actorId: Long,
|
||||
overview: String? = null,
|
||||
text: String,
|
||||
content: String,
|
||||
createdAt: Long,
|
||||
visibility: Visibility,
|
||||
url: String,
|
||||
|
@ -49,10 +50,10 @@ data class Post private constructor(
|
|||
overview
|
||||
}
|
||||
|
||||
val limitedText = if (text.length >= characterLimit.post.text) {
|
||||
text.substring(0, characterLimit.post.text)
|
||||
val limitedText = if (content.length >= characterLimit.post.text) {
|
||||
content.substring(0, characterLimit.post.text)
|
||||
} else {
|
||||
text
|
||||
content
|
||||
}
|
||||
|
||||
require(url.isNotBlank()) { "url must contain non-blank characters" }
|
||||
|
@ -67,6 +68,7 @@ data class Post private constructor(
|
|||
id = id,
|
||||
actorId = actorId,
|
||||
overview = limitedOverview,
|
||||
content = content,
|
||||
text = limitedText,
|
||||
createdAt = createdAt,
|
||||
visibility = visibility,
|
||||
|
@ -94,6 +96,7 @@ data class Post private constructor(
|
|||
id = id,
|
||||
actorId = 0,
|
||||
overview = null,
|
||||
content = "",
|
||||
text = "",
|
||||
createdAt = Instant.EPOCH.toEpochMilli(),
|
||||
visibility = visibility,
|
||||
|
@ -113,6 +116,7 @@ data class Post private constructor(
|
|||
id = this.id,
|
||||
actorId = 0,
|
||||
overview = null,
|
||||
content = "",
|
||||
text = "",
|
||||
createdAt = Instant.EPOCH.toEpochMilli(),
|
||||
visibility = visibility,
|
||||
|
|
|
@ -25,7 +25,7 @@ class PostResultRowMapper(private val postBuilder: Post.PostBuilder) : ResultRow
|
|||
id = resultRow[Posts.id],
|
||||
actorId = resultRow[Posts.actorId],
|
||||
overview = resultRow[Posts.overview],
|
||||
text = resultRow[Posts.text],
|
||||
content = resultRow[Posts.text],
|
||||
createdAt = resultRow[Posts.createdAt],
|
||||
visibility = Visibility.values().first { visibility -> visibility.ordinal == resultRow[Posts.visibility] },
|
||||
url = resultRow[Posts.url],
|
||||
|
|
|
@ -97,7 +97,7 @@ class PostServiceImpl(
|
|||
id = id,
|
||||
actorId = post.userId,
|
||||
overview = post.overview,
|
||||
text = post.text,
|
||||
content = post.text,
|
||||
createdAt = Instant.now().toEpochMilli(),
|
||||
visibility = post.visibility,
|
||||
url = "${user.url}/posts/$id",
|
||||
|
|
|
@ -26,7 +26,7 @@ object PostBuilder {
|
|||
id = id,
|
||||
actorId = userId,
|
||||
overview = overview,
|
||||
text = text,
|
||||
content = text,
|
||||
createdAt = createdAt,
|
||||
visibility = visibility,
|
||||
url = url,
|
||||
|
|
Loading…
Reference in New Issue