1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.main.*
4 import net.pterodactylus.sone.utils.*
5 import net.pterodactylus.sone.web.*
6 import net.pterodactylus.sone.web.page.*
7 import net.pterodactylus.util.template.*
11 * Page that lets the user bookmark a post.
13 @ToadletPath("bookmark.html")
14 class BookmarkPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer)
15 : SoneTemplatePage(webInterface, loaders, templateRenderer, pageTitleKey = "Page.Bookmark.Title") {
17 override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) {
18 if (soneRequest.isPOST) {
19 val returnPage = soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256)
20 val postId = soneRequest.httpRequest.getPartAsStringFailsafe("post", 36)
21 soneRequest.core.getPost(postId)?.let {
22 soneRequest.core.bookmarkPost(it)
24 redirectTo(returnPage)