Fix indentation
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 29 Nov 2017 20:16:34 +0000 (21:16 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 29 Nov 2017 20:16:34 +0000 (21:16 +0100)
src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/LikePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePage.kt
src/main/kotlin/net/pterodactylus/sone/web/pages/UntrustPage.kt

index b63301b..f3486d2 100644 (file)
@@ -10,31 +10,31 @@ import net.pterodactylus.util.template.TemplateContext
 /**
  * Page that lets the user edit the name of a profile field.
  */
-class EditProfileFieldPage(template: Template, webInterface: WebInterface):
+class EditProfileFieldPage(template: Template, webInterface: WebInterface) :
                LoggedInPage("editProfileField.html", template, "Page.EditProfileField.Title", webInterface) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) {
-                       currentSone.profile.let { profile ->
-                               if (freenetRequest.isPOST) {
-                                       if (freenetRequest.httpRequest.getPartAsStringFailsafe("cancel", 4) == "true") {
-                                               throw RedirectException("editProfile.html#profile-fields")
-                                       }
-                                       val field = profile.getFieldById(freenetRequest.httpRequest.getPartAsStringFailsafe("field", 36)) ?: throw RedirectException("invalid.html")
-                                       freenetRequest.httpRequest.getPartAsStringFailsafe("name", 256).let { name ->
-                                               try {
-                                                       if (name != field.name) {
-                                                               field.name = name
-                                                               currentSone.profile = profile
-                                                       }
-                                                       throw RedirectException("editProfile.html#profile-fields")
-                                               } catch (e: IllegalArgumentException) {
-                                                       templateContext["duplicateFieldName"] = true
-                                                       return
+               currentSone.profile.let { profile ->
+                       if (freenetRequest.isPOST) {
+                               if (freenetRequest.httpRequest.getPartAsStringFailsafe("cancel", 4) == "true") {
+                                       throw RedirectException("editProfile.html#profile-fields")
+                               }
+                               val field = profile.getFieldById(freenetRequest.httpRequest.getPartAsStringFailsafe("field", 36)) ?: throw RedirectException("invalid.html")
+                               freenetRequest.httpRequest.getPartAsStringFailsafe("name", 256).let { name ->
+                                       try {
+                                               if (name != field.name) {
+                                                       field.name = name
+                                                       currentSone.profile = profile
                                                }
+                                               throw RedirectException("editProfile.html#profile-fields")
+                                       } catch (e: IllegalArgumentException) {
+                                               templateContext["duplicateFieldName"] = true
+                                               return
                                        }
                                }
-                               templateContext["field"] = profile.getFieldById(freenetRequest.httpRequest.getParam("field")) ?: throw RedirectException("invalid.html")
                        }
+                       templateContext["field"] = profile.getFieldById(freenetRequest.httpRequest.getParam("field")) ?: throw RedirectException("invalid.html")
+               }
        }
 
 }
index 7d6af18..ef622df 100644 (file)
@@ -12,17 +12,17 @@ import net.pterodactylus.util.template.TemplateContext
  * Page that lets the user like [net.pterodactylus.sone.data.Post]s and [net.pterodactylus.sone.data.Reply]s.
  */
 class LikePage(template: Template, webInterface: WebInterface) :
-       LoggedInPage("like.html", template, "Page.Like.Title", webInterface) {
+               LoggedInPage("like.html", template, "Page.Like.Title", webInterface) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
-                               freenetRequest.parameters["type", 16]?.also { type ->
-                                       when(type) {
-                                               "post" -> currentSone.addLikedPostId(freenetRequest.parameters["post", 36]!!)
-                                               "reply" -> currentSone.addLikedReplyId(freenetRequest.parameters["reply", 36]!!)
-                                       }
+                       freenetRequest.parameters["type", 16]?.also { type ->
+                               when (type) {
+                                       "post" -> currentSone.addLikedPostId(freenetRequest.parameters["post", 36]!!)
+                                       "reply" -> currentSone.addLikedReplyId(freenetRequest.parameters["reply", 36]!!)
                                }
-                               throw RedirectException(freenetRequest.parameters["returnPage", 256]!!)
+                       }
+                       throw RedirectException(freenetRequest.parameters["returnPage", 256]!!)
                }
        }
 
index b6fb038..758ae07 100644 (file)
@@ -12,14 +12,14 @@ import net.pterodactylus.util.template.TemplateContext
  * Page that lets the user trust another Sone. This will assign a configurable
  * amount of trust to an identity.
  */
-class TrustPage(template: Template, webInterface: WebInterface):
+class TrustPage(template: Template, webInterface: WebInterface) :
                LoggedInPage("trust.html", template, "Page.Trust.Title", webInterface) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
-                               webInterface.core.getSone(freenetRequest.parameters["sone"]!!)?.let { sone ->
-                                       webInterface.core.trustSone(currentSone, sone)
-                               }
+                       webInterface.core.getSone(freenetRequest.parameters["sone"]!!)?.let { sone ->
+                               webInterface.core.trustSone(currentSone, sone)
+                       }
                        throw RedirectException(freenetRequest.parameters["returnPage", 256])
                }
        }
index ef4eab9..2521ef0 100644 (file)
@@ -11,13 +11,13 @@ import net.pterodactylus.util.template.TemplateContext
 /**
  * This page lets the user unfollow another Sone.
  */
-class UnfollowSonePage(template: Template, webInterface: WebInterface):
+class UnfollowSonePage(template: Template, webInterface: WebInterface) :
                LoggedInPage("unfollowSone.html", template, "Page.UnfollowSone.Title", webInterface) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
-                               freenetRequest.parameters["sone"]!!.split(Regex("[ ,]+"))
-                                               .forEach { webInterface.core.unfollowSone(currentSone, it) }
+                       freenetRequest.parameters["sone"]!!.split(Regex("[ ,]+"))
+                                       .forEach { webInterface.core.unfollowSone(currentSone, it) }
                        throw RedirectException(freenetRequest.parameters["returnPage", 256])
                }
        }
index ad34432..f522c34 100644 (file)
@@ -12,14 +12,14 @@ import net.pterodactylus.util.template.TemplateContext
  * Page that lets the user untrust another Sone. This will remove all trust
  * assignments for an identity.
  */
-class UntrustPage(template: Template, webInterface: WebInterface):
+class UntrustPage(template: Template, webInterface: WebInterface) :
                LoggedInPage("untrust.html", template, "Page.Untrust.Title", webInterface) {
 
        override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) {
                if (freenetRequest.isPOST) {
-                               freenetRequest.parameters["sone", 44]!!
-                                               .let(webInterface.core::getSone)
-                                               ?.also { webInterface.core.untrustSone(currentSone, it) }
+                       freenetRequest.parameters["sone", 44]!!
+                                       .let(webInterface.core::getSone)
+                                       ?.also { webInterface.core.untrustSone(currentSone, it) }
                        throw RedirectException(freenetRequest.parameters["returnPage", 256])
                }
        }