Mercurial > prosody-modules
diff mod_http_muc_log/mod_http_muc_log.lua @ 3578:ea63dc0cc824
mod_http_muc_log: Sort room listing by jid for stable order
It was silly that the list would be shuffled every time you reloaded the
page.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 05 May 2019 11:01:17 +0200 |
parents | 0ebb7112c102 |
children | 444e2306c99a |
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua Sun May 05 10:24:53 2019 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Sun May 05 11:01:17 2019 +0200 @@ -335,6 +335,7 @@ for room in each_room() do if not (room.get_hidden or room.is_hidden)(room) then room_list[i], i = { + jid = room.jid; href = get_link(jid_split(room.jid), nil); name = room:get_name(); description = room:get_description(); @@ -342,6 +343,10 @@ end end + table.sort(room_list, function (a, b) + return a.jid < b.jid; + end); + response.headers.content_type = "text/html; charset=utf-8"; return render(template, { title = module:get_option_string("name", "Prosody Chatrooms");