Changeset

3592:61a9c087730a

mod_http_muc_log: Provide a redirect to 'latest' day with logs (fixes #1360)
author Kim Alvefur <zash@zash.se>
date Mon, 13 May 2019 00:23:04 +0200
parents 3591:3f8383c5a045
children 3593:0b670831ace3
files mod_http_muc_log/mod_http_muc_log.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua	Mon May 13 00:20:19 2019 +0200
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Mon May 13 00:23:04 2019 +0200
@@ -243,6 +243,11 @@
 	elseif is_open == false then
 		return 403;
 	end
+	if date == "latest" then
+		local last_day = find_once(room, { reverse = true }, 3);
+		response.headers.location = datetime.date(last_day);
+		return 303;
+	end
 	local day_start = datetime.parse(date.."T00:00:00Z");
 	if not day_start then
 		module:log("debug", "Invalid date format: %q", date);