import net.pterodactylus.sone.freenet.L10nFilter
import net.pterodactylus.sone.text.TimeTextConverter
import net.pterodactylus.sone.utils.jsonObject
-import net.pterodactylus.sone.utils.let
import net.pterodactylus.sone.utils.parameters
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
/**
* Ajax page that returns a formatted, relative timestamp for replies or posts.
*/
-class GetTimesAjaxPage(webInterface: WebInterface,
+class GetTimesAjaxPage @Inject constructor(webInterface: WebInterface,
private val timeTextConverter: TimeTextConverter,
private val l10nFilter: L10nFilter,
timeZone: TimeZone) : JsonPage("getTimes.ajax", webInterface) {
}
override val needsFormPassword = false
- override fun requiresLogin() = false
+ override val requiresLogin = false
override fun createJsonObject(request: FreenetRequest) =
createSuccessJsonObject().apply {
"tooltip" to synchronized(dateTimeFormatter) {
dateTimeFormatter.format(time)
})
- }.forEach { this@jsonObject.put(it.first, it.second) }
+ }.forEach { this@jsonObject.set(it.first, it.second) }
}
}