🔥 Remove possibility to fetch a custom edition
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 30 Jul 2019 19:45:29 +0000 (21:45 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 30 Jul 2019 19:45:29 +0000 (21:45 +0200)
src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt
src/main/resources/templates/rescue.html
src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt

index be0e4c1..b93d09a 100644 (file)
@@ -21,11 +21,6 @@ class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loader
                val soneRescuer = soneRequest.core.getSoneRescuer(currentSone)
                templateContext["soneRescuer"] = soneRescuer
                if (soneRequest.isPOST) {
                val soneRescuer = soneRequest.core.getSoneRescuer(currentSone)
                templateContext["soneRescuer"] = soneRescuer
                if (soneRequest.isPOST) {
-                       soneRequest.parameters["edition", 9]?.toIntOrNull()?.also {
-                               if (it > -1) {
-                                       soneRescuer.setEdition(it.toLong())
-                               }
-                       }
                        if (soneRequest.parameters["fetch", 8] == "true") {
                                soneRescuer.startNextFetch()
                        }
                        if (soneRequest.parameters["fetch", 8] == "true") {
                                soneRescuer.startNextFetch()
                        }
index e08edc3..d711881 100644 (file)
                <%/if>
                <form action="rescue.html" method="post">
                        <input type="hidden" name="formPassword" value="<%formPassword|html>" />
                <%/if>
                <form action="rescue.html" method="post">
                        <input type="hidden" name="formPassword" value="<%formPassword|html>" />
-                       <label><%= Page.Rescue.Label.NextEdition|l10n|html></label>
-                       <input type="field" name="edition" value="<%soneRescuer.nextEdition>" />
-                       <button type="submit" name="fetch" value="true"><%= Page.Rescue.Button.Fetch|l10n|html></button>
+                       <div>
+                               <%= Page.Rescue.Label.NextEdition|l10n|html>: <%soneRescuer.nextEdition>
+                               <button type="submit" name="fetch" value="true"><%= Page.Rescue.Button.Fetch|l10n|html></button>
+                       </div>
                </form>
        <%else>
                <%if soneRescuer.lastFetchSuccessful>
                </form>
        <%else>
                <%if soneRescuer.lastFetchSuccessful>
index d11352f..85e1f6b 100644 (file)
@@ -54,33 +54,10 @@ class RescuePageTest : WebPageTest(::RescuePage) {
        }
 
        @Test
        }
 
        @Test
-       fun `post request with fetch and invalid edition starts next fetch`() {
+       fun `post request with fetch starts next fetch`() {
                setMethod(POST)
                addHttpRequestPart("fetch", "true")
                verifyRedirect("rescue.html") {
                setMethod(POST)
                addHttpRequestPart("fetch", "true")
                verifyRedirect("rescue.html") {
-                       verify(soneRescuer, never()).setEdition(anyLong())
-                       verify(soneRescuer).startNextFetch()
-               }
-       }
-
-       @Test
-       fun `post request with fetch and valid edition sets edition and starts next fetch`() {
-               setMethod(POST)
-               addHttpRequestPart("fetch", "true")
-               addHttpRequestPart("edition", "123")
-               verifyRedirect("rescue.html") {
-                       verify(soneRescuer).setEdition(123L)
-                       verify(soneRescuer).startNextFetch()
-               }
-       }
-
-       @Test
-       fun `post request with negative edition will not set edition`() {
-               setMethod(POST)
-               addHttpRequestPart("fetch", "true")
-               addHttpRequestPart("edition", "-123")
-               verifyRedirect("rescue.html") {
-                       verify(soneRescuer, never()).setEdition(anyLong())
                        verify(soneRescuer).startNextFetch()
                }
        }
                        verify(soneRescuer).startNextFetch()
                }
        }