projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
🎨 Fix formatting
[Sone.git]
/
src
/
main
/
kotlin
/
net
/
pterodactylus
/
sone
/
web
/
ajax
/
GetStatusAjaxPage.kt
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
acb8cec
..
0017a32
100644
(file)
--- a/
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt
+++ b/
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt
@@
-12,20
+12,23
@@
import net.pterodactylus.sone.freenet.L10nFilter
import net.pterodactylus.sone.template.SoneAccessor
import net.pterodactylus.sone.text.TimeTextConverter
import net.pterodactylus.sone.utils.jsonObject
import net.pterodactylus.sone.template.SoneAccessor
import net.pterodactylus.sone.text.TimeTextConverter
import net.pterodactylus.sone.utils.jsonObject
-import net.pterodactylus.sone.utils.mapPresent
import net.pterodactylus.sone.utils.toArray
import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
import java.text.SimpleDateFormat
import java.util.TimeZone
import net.pterodactylus.sone.utils.toArray
import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
import java.text.SimpleDateFormat
import java.util.TimeZone
+import javax.inject.Inject
/**
* 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 elementLoader: ElementLoader, private val timeTextConverter: TimeTextConverter, private val l10nFilter: L10nFilter, timeZone: TimeZone
= TimeZone.getDefault()
):
+class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: ElementLoader, private val timeTextConverter: TimeTextConverter, private val l10nFilter: L10nFilter, timeZone: TimeZone):
JsonPage("getStatus.ajax", webInterface) {
JsonPage("getStatus.ajax", webInterface) {
+ @Inject constructor(webInterface: WebInterface, elementLoader: ElementLoader, timeTextConverter: TimeTextConverter, l10nFilter: L10nFilter):
+ this(webInterface, elementLoader, timeTextConverter, l10nFilter, TimeZone.getDefault())
+
private val dateFormatter = SimpleDateFormat("MMM d, yyyy, HH:mm:ss").apply {
this.timeZone = timeZone
}
private val dateFormatter = SimpleDateFormat("MMM d, yyyy, HH:mm:ss").apply {
this.timeZone = timeZone
}
@@
-36,7
+39,7
@@
class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: E
this["loggedIn"] = currentSone != null
this["options"] = currentSone?.options?.toJsonOptions() ?: jsonObject {}
this["notificationHash"] = webInterface.getNotifications(currentSone).sortedBy { it.createdTime }.hashCode()
this["loggedIn"] = currentSone != null
this["options"] = currentSone?.options?.toJsonOptions() ?: jsonObject {}
this["notificationHash"] = webInterface.getNotifications(currentSone).sortedBy { it.createdTime }.hashCode()
- this["sones"] = request.httpRequest.getParam("soneIds").split(',').map
Present
(core::getSone).plus(currentSone).filterNotNull().toJsonSones()
+ this["sones"] = request.httpRequest.getParam("soneIds").split(',').map
NotNull
(core::getSone).plus(currentSone).filterNotNull().toJsonSones()
this["newPosts"] = webInterface.getNewPosts(currentSone).toJsonPosts()
this["newReplies"] = webInterface.getNewReplies(currentSone).toJsonReplies()
this["linkedElements"] = request.httpRequest.getParam("elements", "[]").asJson().map(JsonNode::asText).map(elementLoader::loadElement).toJsonElements()
this["newPosts"] = webInterface.getNewPosts(currentSone).toJsonPosts()
this["newReplies"] = webInterface.getNewReplies(currentSone).toJsonReplies()
this["linkedElements"] = request.httpRequest.getParam("elements", "[]").asJson().map(JsonNode::asText).map(elementLoader::loadElement).toJsonElements()