mirror of https://github.com/usbharu/Hideout.git
wip
This commit is contained in:
parent
0463ad6b69
commit
57afdcdd7b
|
@ -13,6 +13,7 @@ import org.springframework.ui.Model
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute
|
import org.springframework.web.bind.annotation.ModelAttribute
|
||||||
import org.springframework.web.bind.annotation.PostMapping
|
import org.springframework.web.bind.annotation.PostMapping
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
class PublishController(
|
class PublishController(
|
||||||
|
@ -22,7 +23,7 @@ class PublishController(
|
||||||
private val userRegisterLocalPostApplicationService: RegisterLocalPostApplicationService
|
private val userRegisterLocalPostApplicationService: RegisterLocalPostApplicationService
|
||||||
) {
|
) {
|
||||||
@GetMapping("/publish")
|
@GetMapping("/publish")
|
||||||
suspend fun publish(model: Model): String {
|
suspend fun publish(model: Model,@RequestParam replyTo: Long?,@RequestParam repost: Long?): String {
|
||||||
val principal = springSecurityFormLoginPrincipalContextHolder.getPrincipal()
|
val principal = springSecurityFormLoginPrincipalContextHolder.getPrincipal()
|
||||||
|
|
||||||
if (principal.userDetailId == null) {
|
if (principal.userDetailId == null) {
|
||||||
|
@ -35,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())
|
model.addAttribute("form", PublishPost(replyTo = replyTo, repost = repost))
|
||||||
return "post-postForm"
|
return "post-postForm"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,8 +51,8 @@ class PublishController(
|
||||||
content = publishPost.status.orEmpty(),
|
content = publishPost.status.orEmpty(),
|
||||||
overview = publishPost.overview,
|
overview = publishPost.overview,
|
||||||
visibility = Visibility.valueOf(publishPost.visibility.uppercase()),
|
visibility = Visibility.valueOf(publishPost.visibility.uppercase()),
|
||||||
repostId = null,
|
repostId = publishPost.repost,
|
||||||
replyId = null,
|
replyId = publishPost.replyTo,
|
||||||
sensitive = false,
|
sensitive = false,
|
||||||
mediaIds = emptyList()
|
mediaIds = emptyList()
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
package dev.usbharu.hideout.core.interfaces.web.posts
|
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
|
||||||
|
)
|
||||||
|
|
|
@ -19,7 +19,9 @@ post-form.new-posts=\u65B0\u3057\u3044\u6295\u7A3F!
|
||||||
post-form.new-posts-cw=CW
|
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-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-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-submit=\u6295\u7A3F\u3059\u308B
|
||||||
|
post-form.new-posts.repost=\u30EA\u30DD\u30B9\u30C8
|
||||||
post.repost=\u30EA\u30DD\u30B9\u30C8
|
post.repost=\u30EA\u30DD\u30B9\u30C8
|
||||||
post.repost-by={0}\u304C\u30EA\u30DD\u30B9\u30C8
|
post.repost-by={0}\u304C\u30EA\u30DD\u30B9\u30C8
|
||||||
user-by-id.followersCount={0} \u30D5\u30A9\u30ED\u30EF\u30FC
|
user-by-id.followersCount={0} \u30D5\u30A9\u30ED\u30EF\u30FC
|
||||||
|
|
|
@ -18,7 +18,9 @@ post-form.new-posts=New Posts!
|
||||||
post-form.new-posts-cw=CW
|
post-form.new-posts-cw=CW
|
||||||
post-form.new-posts-cw-title=Add content warning
|
post-form.new-posts-cw-title=Add content warning
|
||||||
post-form.new-posts-form-label=What's on your mind?
|
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-submit=Submit!
|
||||||
|
post-form.new-posts.repost=Repost
|
||||||
post.repost=Repost
|
post.repost=Repost
|
||||||
post.repost-by=Repost by {0}
|
post.repost-by=Repost by {0}
|
||||||
user-by-id.followersCount={0} Followers
|
user-by-id.followersCount={0} Followers
|
||||||
|
|
|
@ -19,7 +19,9 @@ post-form.new-posts=\u65B0\u3057\u3044\u6295\u7A3F!
|
||||||
post-form.new-posts-cw=CW
|
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-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-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-submit=\u6295\u7A3F\u3059\u308B
|
||||||
|
post-form.new-posts.repost=\u30EA\u30DD\u30B9\u30C8
|
||||||
post.repost=\u30EA\u30DD\u30B9\u30C8
|
post.repost=\u30EA\u30DD\u30B9\u30C8
|
||||||
post.repost-by={0}\u304C\u30EA\u30DD\u30B9\u30C8
|
post.repost-by={0}\u304C\u30EA\u30DD\u30B9\u30C8
|
||||||
user-by-id.followersCount={0} \u30D5\u30A9\u30ED\u30EF\u30FC
|
user-by-id.followersCount={0} \u30D5\u30A9\u30ED\u30EF\u30FC
|
||||||
|
|
|
@ -16,6 +16,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form action="/publish" method="post" th:action="@{/publish}" th:object="${form}">
|
<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}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="status-form-repost" th:text="#{post-form.new-posts.repost}">Repost</label>
|
||||||
|
<input id="status-form-repost" name="repost" type="number" th:value="${form.repost}">
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="stats-form-overview" th:text="#{post-form.new-posts-cw}"
|
<label for="stats-form-overview" th:text="#{post-form.new-posts-cw}"
|
||||||
th:title="#{post-form.new-posts-cw-title}"
|
th:title="#{post-form.new-posts-cw-title}"
|
||||||
|
@ -31,13 +39,16 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend th:text="#{common.visibility}">Visibility</legend>
|
<legend th:text="#{common.visibility}">Visibility</legend>
|
||||||
<label for="status-form-visibility-public" th:text="#{common.visibility-public}">Public</label>
|
<label for="status-form-visibility-public" th:text="#{common.visibility-public}">Public</label>
|
||||||
<input id="status-form-visibility-public" name="visibility" th:checked="${form.visibility == 'PUBLIC'}" type="radio"
|
<input id="status-form-visibility-public" name="visibility" th:checked="${form.visibility == 'PUBLIC'}"
|
||||||
|
type="radio"
|
||||||
value="PUBLIC">
|
value="PUBLIC">
|
||||||
<label for="status-form-visibility-unlisted" th:text="#{common.visibility-unlisted}">Unlisted</label>
|
<label for="status-form-visibility-unlisted" th:text="#{common.visibility-unlisted}">Unlisted</label>
|
||||||
<input id="status-form-visibility-unlisted" name="visibility" th:checked="${form.visibility == 'UNLISTED'}" type="radio"
|
<input id="status-form-visibility-unlisted" name="visibility"
|
||||||
|
th:checked="${form.visibility == 'UNLISTED'}" type="radio"
|
||||||
value="UNLISTED">
|
value="UNLISTED">
|
||||||
<label for="status-form-visibility-followers" th:text="#{common.visibility-followers}">Followers</label>
|
<label for="status-form-visibility-followers" th:text="#{common.visibility-followers}">Followers</label>
|
||||||
<input id="status-form-visibility-followers" name="visibility" th:checked="${form.visibility == 'FOLLOWERS'}" type="radio"
|
<input id="status-form-visibility-followers" name="visibility"
|
||||||
|
th:checked="${form.visibility == 'FOLLOWERS'}" type="radio"
|
||||||
value="FOLLOWERS">
|
value="FOLLOWERS">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
<div>
|
<div>
|
||||||
<img height="150px" th:src="${user.iconUrl}" width="150px">
|
<img height="150px" th:src="${user.iconUrl}" width="150px" alt="">
|
||||||
<img height="150px" th:src="${user.bannerURL}" width="600px">
|
<img height="150px" th:src="${user.bannerURL}" width="600px" alt="">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<th:block th:if="${user.locked}">
|
<th:block th:if="${user.locked}">
|
||||||
|
|
Loading…
Reference in New Issue