From: David ‘Bombe’ Roden Date: Tue, 30 Jul 2019 19:45:29 +0000 (+0200) Subject: 🔥 Remove possibility to fetch a custom edition X-Git-Tag: v81^2~151 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e9e1d2c56b52798136ff8f7a6f8c94257226d472;p=Sone.git 🔥 Remove possibility to fetch a custom edition --- diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt index be0e4c1..b93d09a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt @@ -21,11 +21,6 @@ class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loader 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() } diff --git a/src/main/resources/templates/rescue.html b/src/main/resources/templates/rescue.html index e08edc3..d711881 100644 --- a/src/main/resources/templates/rescue.html +++ b/src/main/resources/templates/rescue.html @@ -16,9 +16,10 @@ <%/if>
- - - +
+ <%= Page.Rescue.Label.NextEdition|l10n|html>: <%soneRescuer.nextEdition> + +
<%else> <%if soneRescuer.lastFetchSuccessful> diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt index d11352f..85e1f6b 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt @@ -54,33 +54,10 @@ class RescuePageTest : WebPageTest(::RescuePage) { } @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") { - 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() } }