import net.pterodactylus.sone.data.Post
import net.pterodactylus.sone.data.PostReply
import net.pterodactylus.sone.data.Sone
import net.pterodactylus.sone.data.Post
import net.pterodactylus.sone.data.PostReply
import net.pterodactylus.sone.data.Sone
* The “get status” AJAX handler returns all information that is necessary to
* update the web interface in real-time.
*/
* The “get status” AJAX handler returns all information that is necessary to
* update the web interface in real-time.
*/
-class GetStatusAjaxPage(webInterface: WebInterface, private val timeTextConverter: TimeTextConverter, private val l10nFilter: L10nFilter):
+class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: ElementLoader, private val timeTextConverter: TimeTextConverter, private val l10nFilter: L10nFilter):
JsonPage("getStatus.ajax", webInterface) {
private val dateFormatter = SimpleDateFormat("MMM d, yyyy, HH:mm:ss")
JsonPage("getStatus.ajax", webInterface) {
private val dateFormatter = SimpleDateFormat("MMM d, yyyy, HH:mm:ss")
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["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()
private operator fun JsonReturnObject.set(key: String, value: Int) = put(key, value)
private operator fun JsonReturnObject.set(key: String, value: Boolean) = put(key, value)
private operator fun JsonReturnObject.set(key: String, value: Int) = put(key, value)
private operator fun JsonReturnObject.set(key: String, value: Boolean) = put(key, value)