# HG changeset patch # User Kim Alvefur # Date 1631399326 -7200 # Node ID 823370bc2e4c32cf1717adfde79aec5b7f986ba9 # Parent a2cf3b69a3d669975f47a480da8f1bce56225cb1 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. diff -r a2cf3b69a3d6 -r 823370bc2e4c mod_http_muc_log/README.markdown --- a/mod_http_muc_log/README.markdown Sun Sep 12 00:13:32 2021 +0200 +++ b/mod_http_muc_log/README.markdown Sun Sep 12 00:28:46 2021 +0200 @@ -89,8 +89,9 @@ ## Pinned chatrooms -The room list page is normally sorted by address. To override this, or -pin certain rooms to the top: +The room list page is normally sorted by address, rooms having a +description before those that don't. To override this, or pin certain +rooms to the top: ``` lua http_muc_log_list_order = { diff -r a2cf3b69a3d6 -r 823370bc2e4c mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Sun Sep 12 00:13:32 2021 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Sun Sep 12 00:28:46 2021 +0200 @@ -461,6 +461,11 @@ table.sort(room_list, function (a, b) if a.priority ~= b.priority then return a.priority > b.priority; end + if a.description ~= nil and b.description == nil then + return true; + elseif a.description == nil and b.description ~= nil then + return false; + end return a.jid < b.jid; end);