comparison mod_http_muc_log/mod_http_muc_log.lua @ 1552:81b3599c02fb

mod_http_muc_log: Have URL of date list page end with a slash
author Kim Alvefur <zash@zash.se>
date Sun, 09 Nov 2014 08:32:43 +0100
parents 1b2823b41f7f
children 1398d2bbcd42
comparison
equal deleted inserted replaced
1551:5127f4db9d39 1552:81b3599c02fb
91 local page_template = template(base{ 91 local page_template = template(base{
92 title = "Logs for room {room} on {date}"; 92 title = "Logs for room {room} on {date}";
93 body = [[ 93 body = [[
94 <nav> 94 <nav>
95 <a class="prev" href="{prev}">←</a> 95 <a class="prev" href="{prev}">←</a>
96 <a class="up" href="../{room}">↑</a> 96 <a class="up" href=".">↑</a>
97 <a class="next" href="{next}">→</a> 97 <a class="next" href="{next}">→</a>
98 </nav> 98 </nav>
99 <ul> 99 <ul>
100 {logs!} 100 {logs!}
101 </ul> 101 </ul>
125 </dl> 125 </dl>
126 ]]; 126 ]];
127 }); 127 });
128 128
129 local room_item_template = template[[ 129 local room_item_template = template[[
130 <dt><a href="{room}">{name}</a></dt> 130 <dt><a href="{room}/">{name}</a></dt>
131 <dd>{description?}</dd> 131 <dd>{description?}</dd>
132 ]]; 132 ]];
133 133
134 local function public_room(room) 134 local function public_room(room)
135 if type(room) == "string" then 135 if type(room) == "string" then
137 end 137 end
138 return room and not room:get_hidden() and not room:get_members_only() and room._data.logging ~= false; 138 return room and not room:get_hidden() and not room:get_members_only() and room._data.logging ~= false;
139 end 139 end
140 140
141 -- FIXME Invent some more efficient API for this 141 -- FIXME Invent some more efficient API for this
142 local function dates_page(event, room) 142 local function dates_page(event, path)
143 local request, response = event.request, event.response; 143 local request, response = event.request, event.response;
144 144
145 room = nodeprep(room); 145 local room = nodeprep(path:match("^(.*)/$"));
146 if not room or not public_room(room) then return end 146 if not room or not public_room(room) then return end
147 147
148 local dates, i = {}, 1; 148 local dates, i = {}, 1;
149 module:log("debug", "Find all dates with messages"); 149 module:log("debug", "Find all dates with messages");
150 local next_day; 150 local next_day;