diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/interfaces/web/posts/PublishController.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/interfaces/web/posts/PublishController.kt index 86eb8db7..5620adf6 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/interfaces/web/posts/PublishController.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/interfaces/web/posts/PublishController.kt @@ -13,6 +13,7 @@ import org.springframework.ui.Model import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.ModelAttribute import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestParam @Controller class PublishController( @@ -22,7 +23,7 @@ class PublishController( private val userRegisterLocalPostApplicationService: RegisterLocalPostApplicationService ) { @GetMapping("/publish") - suspend fun publish(model: Model): String { + suspend fun publish(model: Model,@RequestParam replyTo: Long?,@RequestParam repost: Long?): String { val principal = springSecurityFormLoginPrincipalContextHolder.getPrincipal() if (principal.userDetailId == null) { @@ -35,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()) + model.addAttribute("form", PublishPost(replyTo = replyTo, repost = repost)) return "post-postForm" } @@ -50,8 +51,8 @@ class PublishController( content = publishPost.status.orEmpty(), overview = publishPost.overview, visibility = Visibility.valueOf(publishPost.visibility.uppercase()), - repostId = null, - replyId = null, + repostId = publishPost.repost, + replyId = publishPost.replyTo, sensitive = false, mediaIds = emptyList() ) diff --git a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/interfaces/web/posts/PublishPost.kt b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/interfaces/web/posts/PublishPost.kt index c732d2eb..be5bcb38 100644 --- a/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/interfaces/web/posts/PublishPost.kt +++ b/hideout-core/src/main/kotlin/dev/usbharu/hideout/core/interfaces/web/posts/PublishPost.kt @@ -1,3 +1,9 @@ package dev.usbharu.hideout.core.interfaces.web.posts -data class PublishPost(var status: String? = null, var overview: String? = null, var visibility: String = "PUBLIC") +data class PublishPost( + var status: String? = null, + var overview: String? = null, + var visibility: String = "PUBLIC", + var replyTo: Long? = null, + var repost: Long? = null +) diff --git a/hideout-core/src/main/resources/messages/hideout-web-messages.properties b/hideout-core/src/main/resources/messages/hideout-web-messages.properties index 2b25be8d..f2b9318e 100644 --- a/hideout-core/src/main/resources/messages/hideout-web-messages.properties +++ b/hideout-core/src/main/resources/messages/hideout-web-messages.properties @@ -19,7 +19,9 @@ post-form.new-posts=\u65B0\u3057\u3044\u6295\u7A3F! post-form.new-posts-cw=CW post-form.new-posts-cw-title=\u30B3\u30F3\u30C6\u30F3\u30C4\u306B\u95B2\u89A7\u6CE8\u610F\u3092\u3064\u3051\u308B post-form.new-posts-form-label=\u4ECA\u306A\u306B\u3057\u3066\u308B? +post-form.new-posts-replyTo=\u8FD4\u4FE1\u5148 post-form.new-posts-submit=\u6295\u7A3F\u3059\u308B +post-form.new-posts.repost=\u30EA\u30DD\u30B9\u30C8 post.repost=\u30EA\u30DD\u30B9\u30C8 post.repost-by={0}\u304C\u30EA\u30DD\u30B9\u30C8 user-by-id.followersCount={0} \u30D5\u30A9\u30ED\u30EF\u30FC diff --git a/hideout-core/src/main/resources/messages/hideout-web-messages_en_US.properties b/hideout-core/src/main/resources/messages/hideout-web-messages_en_US.properties index e679799d..67b651f8 100644 --- a/hideout-core/src/main/resources/messages/hideout-web-messages_en_US.properties +++ b/hideout-core/src/main/resources/messages/hideout-web-messages_en_US.properties @@ -18,7 +18,9 @@ post-form.new-posts=New Posts! post-form.new-posts-cw=CW post-form.new-posts-cw-title=Add content warning post-form.new-posts-form-label=What's on your mind? +post-form.new-posts-replyTo=Reply to post-form.new-posts-submit=Submit! +post-form.new-posts.repost=Repost post.repost=Repost post.repost-by=Repost by {0} user-by-id.followersCount={0} Followers diff --git a/hideout-core/src/main/resources/messages/hideout-web-messages_ja_JP.properties b/hideout-core/src/main/resources/messages/hideout-web-messages_ja_JP.properties index 2b25be8d..f2b9318e 100644 --- a/hideout-core/src/main/resources/messages/hideout-web-messages_ja_JP.properties +++ b/hideout-core/src/main/resources/messages/hideout-web-messages_ja_JP.properties @@ -19,7 +19,9 @@ post-form.new-posts=\u65B0\u3057\u3044\u6295\u7A3F! post-form.new-posts-cw=CW post-form.new-posts-cw-title=\u30B3\u30F3\u30C6\u30F3\u30C4\u306B\u95B2\u89A7\u6CE8\u610F\u3092\u3064\u3051\u308B post-form.new-posts-form-label=\u4ECA\u306A\u306B\u3057\u3066\u308B? +post-form.new-posts-replyTo=\u8FD4\u4FE1\u5148 post-form.new-posts-submit=\u6295\u7A3F\u3059\u308B +post-form.new-posts.repost=\u30EA\u30DD\u30B9\u30C8 post.repost=\u30EA\u30DD\u30B9\u30C8 post.repost-by={0}\u304C\u30EA\u30DD\u30B9\u30C8 user-by-id.followersCount={0} \u30D5\u30A9\u30ED\u30EF\u30FC diff --git a/hideout-core/src/main/resources/templates/post-postForm.html b/hideout-core/src/main/resources/templates/post-postForm.html index a53bfba4..66ae1fd0 100644 --- a/hideout-core/src/main/resources/templates/post-postForm.html +++ b/hideout-core/src/main/resources/templates/post-postForm.html @@ -16,6 +16,14 @@
+
+ + +
+
+ + +
diff --git a/hideout-core/src/main/resources/templates/userById.html b/hideout-core/src/main/resources/templates/userById.html index 88fa9727..66212568 100644 --- a/hideout-core/src/main/resources/templates/userById.html +++ b/hideout-core/src/main/resources/templates/userById.html @@ -7,8 +7,8 @@