Software /
code /
prosody-modules
Diff
mod_http_muc_log/mod_http_muc_log.lua @ 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 |
parent | 3591:3f8383c5a045 |
child | 3593:0b670831ace3 |
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);