feat: 投稿に直接返信できるように

This commit is contained in:
usbharu 2024-09-04 16:26:47 +09:00
parent 57afdcdd7b
commit 975fd5160b
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
4 changed files with 6 additions and 5 deletions

View File

@ -23,7 +23,7 @@ class PublishController(
private val userRegisterLocalPostApplicationService: RegisterLocalPostApplicationService
) {
@GetMapping("/publish")
suspend fun publish(model: Model,@RequestParam replyTo: Long?,@RequestParam repost: Long?): String {
suspend fun publish(model: Model, @RequestParam("reply_to") replyTo: Long?, @RequestParam repost: Long?): String {
val principal = springSecurityFormLoginPrincipalContextHolder.getPrincipal()
if (principal.userDetailId == null) {
@ -36,7 +36,7 @@ class PublishController(
val userDetail = getUserDetailApplicationService.execute(GetUserDetail(principal.userDetailId!!.id), principal)
model.addAttribute("instance", instance)
model.addAttribute("user", userDetail)
model.addAttribute("form", PublishPost(replyTo = replyTo, repost = repost))
model.addAttribute("form", PublishPost(reply_to = replyTo, repost = repost))
return "post-postForm"
}
@ -52,7 +52,7 @@ class PublishController(
overview = publishPost.overview,
visibility = Visibility.valueOf(publishPost.visibility.uppercase()),
repostId = publishPost.repost,
replyId = publishPost.replyTo,
replyId = publishPost.reply_to,
sensitive = false,
mediaIds = emptyList()
)

View File

@ -4,6 +4,6 @@ data class PublishPost(
var status: String? = null,
var overview: String? = null,
var visibility: String = "PUBLIC",
var replyTo: Long? = null,
var reply_to: Long? = null,
var repost: Long? = null
)

View File

@ -43,6 +43,7 @@
<div class="post-controller" th:fragment="single-post-controller(post)">
<!--/*@thymesVar id="post" type="dev.usbharu.hideout.core.application.post.PostDetail"*/-->
<a th:href="${'/publish?reply_to=' + post.id}">Reply</a>
<a th:href="${post.apId}">
<time th:datetime="${post.createdAt}" th:text="${#temporals.format(post.createdAt, 'yyyy-MM-dd HH:mm')}"></time>
</a>

View File

@ -18,7 +18,7 @@
<form action="/publish" method="post" th:action="@{/publish}" th:object="${form}">
<div>
<label for="status-form-replyto" th:text="#{post-form.new-posts-replyTo}">Reply to</label>
<input id="status-form-replyto" name="reply_to" type="number" th:value="${form.replyTo}">
<input id="status-form-replyto" name="reply_to" th:value="${form.reply_to}" type="number">
</div>
<div>
<label for="status-form-repost" th:text="#{post-form.new-posts.repost}">Repost</label>