From: David ‘Bombe’ Roden Date: Thu, 6 Apr 2017 04:51:44 +0000 (+0200) Subject: Rename object for linked elements in JSON reply X-Git-Tag: 0.9.7^2~268 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a979c29be02a3b18e7c2104f3f7b780fea9c6f13;p=Sone.git Rename object for linked elements in JSON reply --- diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt index d7884bf..05a69d7 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt @@ -35,7 +35,7 @@ class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: E this["sones"] = request.httpRequest.getParam("soneIds").split(',').map { webInterface.core.getSone(it).orNull() }.plus(currentSone).filterNotNull().toJsonSones() this["newPosts"] = webInterface.getNewPosts(currentSone).toJsonPosts() this["newReplies"] = webInterface.getNewReplies(currentSone).toJsonReplies() - this["loadedElements"] = request.httpRequest.getParam("elements", "[]").asJson().map(JsonNode::asText).map(elementLoader::loadElement).toJsonElements() + this["linkedElements"] = request.httpRequest.getParam("elements", "[]").asJson().map(JsonNode::asText).map(elementLoader::loadElement).toJsonElements() } } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt index 9ec927d..01c4625 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt @@ -141,7 +141,7 @@ class GetStatusAjaxPageTest: JsonPageTest() { addLoadedElement("KSK@test.html", loading = true, failed = false) addLoadedElement("KSK@test.jpeg", loading = false, failed = true) addRequestParameter("elements", jsonArray("KSK@test.png", "KSK@test.html", "KSK@test.jpeg").toString()) - assertThat(json.get("loadedElements").elements().asSequence().map { it.toMap() }.toList(), containsInAnyOrder( + assertThat(json.get("linkedElements").elements().asSequence().map { it.toMap() }.toList(), containsInAnyOrder( mapOf("link" to "KSK@test.png", "loading" to "false", "failed" to "false"), mapOf("link" to "KSK@test.html", "loading" to "true", "failed" to "false"), mapOf("link" to "KSK@test.jpeg", "loading" to "false", "failed" to "true")