Rename object for linked elements in JSON reply
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 6 Apr 2017 04:51:44 +0000 (06:51 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 8 Apr 2017 13:22:56 +0000 (15:22 +0200)
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt
src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt

index d7884bf..05a69d7 100644 (file)
@@ -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()
                                }
                        }
 
index 9ec927d..01c4625 100644 (file)
@@ -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<String, String?>("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")