Comparison

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
comparison
equal deleted inserted replaced
3591:3f8383c5a045 3592:61a9c087730a
241 if is_open == nil then 241 if is_open == nil then
242 return -- implicit 404 242 return -- implicit 404
243 elseif is_open == false then 243 elseif is_open == false then
244 return 403; 244 return 403;
245 end 245 end
246 if date == "latest" then
247 local last_day = find_once(room, { reverse = true }, 3);
248 response.headers.location = datetime.date(last_day);
249 return 303;
250 end
246 local day_start = datetime.parse(date.."T00:00:00Z"); 251 local day_start = datetime.parse(date.."T00:00:00Z");
247 if not day_start then 252 if not day_start then
248 module:log("debug", "Invalid date format: %q", date); 253 module:log("debug", "Invalid date format: %q", date);
249 return 400; 254 return 400;
250 end 255 end