X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetStatusAjaxPage.kt;h=0b31588da31d0290d2408de48acec5ea2ea57850;hp=5d1726279851cec9aa4d746bef1d3fe393f7cfe0;hb=05d126a69fbd464bea6aa974cff52dc4e5d5b2a6;hpb=3ef366568695ff12fd945a506e53d6279b2337c5 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 5d17262..0b31588 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt @@ -13,6 +13,7 @@ import net.pterodactylus.sone.template.SoneAccessor import net.pterodactylus.sone.text.TimeTextConverter import net.pterodactylus.sone.utils.jsonObject import net.pterodactylus.sone.utils.toArray +import net.pterodactylus.sone.web.NewElements import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* import java.text.SimpleDateFormat @@ -24,11 +25,11 @@ import javax.inject.Inject * update the web interface in real-time. */ @ToadletPath("getStatus.ajax") -class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: ElementLoader, private val timeTextConverter: TimeTextConverter, private val l10nFilter: L10nFilter, timeZone: TimeZone): +class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: ElementLoader, private val newElements: NewElements, private val timeTextConverter: TimeTextConverter, private val l10nFilter: L10nFilter, timeZone: TimeZone): JsonPage(webInterface) { - @Inject constructor(webInterface: WebInterface, elementLoader: ElementLoader, timeTextConverter: TimeTextConverter, l10nFilter: L10nFilter): - this(webInterface, elementLoader, timeTextConverter, l10nFilter, TimeZone.getDefault()) + @Inject constructor(webInterface: WebInterface, elementLoader: ElementLoader, newElements: NewElements, timeTextConverter: TimeTextConverter, l10nFilter: L10nFilter): + this(webInterface, elementLoader, newElements, timeTextConverter, l10nFilter, TimeZone.getDefault()) private val dateFormatter = SimpleDateFormat("MMM d, yyyy, HH:mm:ss").apply { this.timeZone = timeZone @@ -41,8 +42,8 @@ class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: E this["options"] = currentSone?.options?.toJsonOptions() ?: jsonObject {} this["notificationHash"] = webInterface.getNotifications(currentSone).sortedBy { it.createdTime }.hashCode() this["sones"] = request.httpRequest.getParam("soneIds").split(',').mapNotNull(core::getSone).plus(currentSone).filterNotNull().toJsonSones() - this["newPosts"] = webInterface.getNewPosts(currentSone).toJsonPosts() - this["newReplies"] = webInterface.getNewReplies(currentSone).toJsonReplies() + this["newPosts"] = newElements.newPosts.toJsonPosts() + this["newReplies"] = newElements.newReplies.toJsonReplies() this["linkedElements"] = request.httpRequest.getParam("elements", "[]").asJson().map(JsonNode::asText).map(elementLoader::loadElement).toJsonElements() } }