mirror of https://github.com/usbharu/Hideout.git
feat: 投稿に直接返信できるように
This commit is contained in:
parent
57afdcdd7b
commit
975fd5160b
|
@ -23,7 +23,7 @@ class PublishController(
|
||||||
private val userRegisterLocalPostApplicationService: RegisterLocalPostApplicationService
|
private val userRegisterLocalPostApplicationService: RegisterLocalPostApplicationService
|
||||||
) {
|
) {
|
||||||
@GetMapping("/publish")
|
@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()
|
val principal = springSecurityFormLoginPrincipalContextHolder.getPrincipal()
|
||||||
|
|
||||||
if (principal.userDetailId == null) {
|
if (principal.userDetailId == null) {
|
||||||
|
@ -36,7 +36,7 @@ class PublishController(
|
||||||
val userDetail = getUserDetailApplicationService.execute(GetUserDetail(principal.userDetailId!!.id), principal)
|
val userDetail = getUserDetailApplicationService.execute(GetUserDetail(principal.userDetailId!!.id), principal)
|
||||||
model.addAttribute("instance", instance)
|
model.addAttribute("instance", instance)
|
||||||
model.addAttribute("user", userDetail)
|
model.addAttribute("user", userDetail)
|
||||||
model.addAttribute("form", PublishPost(replyTo = replyTo, repost = repost))
|
model.addAttribute("form", PublishPost(reply_to = replyTo, repost = repost))
|
||||||
return "post-postForm"
|
return "post-postForm"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class PublishController(
|
||||||
overview = publishPost.overview,
|
overview = publishPost.overview,
|
||||||
visibility = Visibility.valueOf(publishPost.visibility.uppercase()),
|
visibility = Visibility.valueOf(publishPost.visibility.uppercase()),
|
||||||
repostId = publishPost.repost,
|
repostId = publishPost.repost,
|
||||||
replyId = publishPost.replyTo,
|
replyId = publishPost.reply_to,
|
||||||
sensitive = false,
|
sensitive = false,
|
||||||
mediaIds = emptyList()
|
mediaIds = emptyList()
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,6 +4,6 @@ data class PublishPost(
|
||||||
var status: String? = null,
|
var status: String? = null,
|
||||||
var overview: String? = null,
|
var overview: String? = null,
|
||||||
var visibility: String = "PUBLIC",
|
var visibility: String = "PUBLIC",
|
||||||
var replyTo: Long? = null,
|
var reply_to: Long? = null,
|
||||||
var repost: Long? = null
|
var repost: Long? = null
|
||||||
)
|
)
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
<div class="post-controller" th:fragment="single-post-controller(post)">
|
<div class="post-controller" th:fragment="single-post-controller(post)">
|
||||||
<!--/*@thymesVar id="post" type="dev.usbharu.hideout.core.application.post.PostDetail"*/-->
|
<!--/*@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}">
|
<a th:href="${post.apId}">
|
||||||
<time th:datetime="${post.createdAt}" th:text="${#temporals.format(post.createdAt, 'yyyy-MM-dd HH:mm')}"></time>
|
<time th:datetime="${post.createdAt}" th:text="${#temporals.format(post.createdAt, 'yyyy-MM-dd HH:mm')}"></time>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<form action="/publish" method="post" th:action="@{/publish}" th:object="${form}">
|
<form action="/publish" method="post" th:action="@{/publish}" th:object="${form}">
|
||||||
<div>
|
<div>
|
||||||
<label for="status-form-replyto" th:text="#{post-form.new-posts-replyTo}">Reply to</label>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<label for="status-form-repost" th:text="#{post-form.new-posts.repost}">Repost</label>
|
<label for="status-form-repost" th:text="#{post-form.new-posts.repost}">Repost</label>
|
||||||
|
|
Loading…
Reference in New Issue