Mercurial > prosody-modules
comparison mod_http_muc_log/mod_http_muc_log.lua @ 4677:823370bc2e4c
mod_http_muc_log: Sort rooms with a description before those without
The listing looks nicer when rooms have proper titles and descriptions,
therefore those that have this should be rewarded.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 12 Sep 2021 00:28:46 +0200 |
| parents | a2cf3b69a3d6 |
| children | 306066898e5f |
comparison
equal
deleted
inserted
replaced
| 4676:a2cf3b69a3d6 | 4677:823370bc2e4c |
|---|---|
| 459 end | 459 end |
| 460 end | 460 end |
| 461 | 461 |
| 462 table.sort(room_list, function (a, b) | 462 table.sort(room_list, function (a, b) |
| 463 if a.priority ~= b.priority then return a.priority > b.priority; end | 463 if a.priority ~= b.priority then return a.priority > b.priority; end |
| 464 if a.description ~= nil and b.description == nil then | |
| 465 return true; | |
| 466 elseif a.description == nil and b.description ~= nil then | |
| 467 return false; | |
| 468 end | |
| 464 return a.jid < b.jid; | 469 return a.jid < b.jid; |
| 465 end); | 470 end); |
| 466 | 471 |
| 467 response.headers.content_type = "text/html; charset=utf-8"; | 472 response.headers.content_type = "text/html; charset=utf-8"; |
| 468 return render(template, { | 473 return render(template, { |
