Actually store the profile back in the Sone
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 29 Nov 2017 21:11:01 +0000 (22:11 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 29 Nov 2017 21:11:01 +0000 (22:11 +0100)
src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfilePage.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/EditProfilePageTest.kt

index 1166208..95c40c8 100644 (file)
@@ -37,6 +37,7 @@ class EditProfilePage(template: Template, webInterface: WebInterface) :
                                        profile.fields.forEach { field ->
                                                field.value = TextFilter.filter(freenetRequest.httpRequest.getHeader("Host"), freenetRequest.httpRequest.getPartAsStringFailsafe("field-${field.id}", 400).trim())
                                        }
+                                       currentSone.profile = profile
                                        webInterface.core.touchConfiguration()
                                        throw RedirectException("editProfile.html")
                                } else if (freenetRequest.httpRequest.getPartAsStringFailsafe("add-field", 4) == "true") {
index f76786a..b4e6570 100644 (file)
@@ -86,6 +86,7 @@ class EditProfilePageTest: WebPageTest(::EditProfilePage) {
                addHttpRequestPart("save-profile", "true")
                addHttpRequestPart(fieldName, newValue.toString())
                verifyRedirect("editProfile.html") {
+                       verify(currentSone).profile = profile
                        verify(core).touchConfiguration()
                        assertThat(fieldAccessor(), equalTo(expectedValue))
                }