# HG changeset patch # User Kim Alvefur # Date 1660606079 -7200 # Node ID b74d592df9e2f8e3af1e3437459b629780a08847 # Parent 732229fe68ab0a3566cca63d756c226134a6b2d1 mod_http_muc_log: Remove dead code This might be something left over since a different variant where the loop went like `for n = i-1, i-100, -1 do ... end` i.e. it went trough a fixed number of items instead of all the page until the current message. Then it would have needed something to stop going over the end, but since the checks are simple it shouldn't be much of a problem looping over even a very busy day. diff -r 732229fe68ab -r b74d592df9e2 mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Mon Aug 15 15:26:14 2022 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Tue Aug 16 01:27:59 2022 +0200 @@ -348,9 +348,7 @@ if edit then local found = false; for n = i-1, 1, -1 do - if not logs[n] then - break; -- Probably reached logs[0] - elseif logs[n].id == edit and nick == logs[n].nick then + if logs[n].id == edit and nick == logs[n].nick then found = true; logs[n].edited = key; edit = logs[n].key; @@ -369,9 +367,7 @@ -- COMPAT Movim uses an @to attribute instead of the correct @id local target_id = reactions.attr.id or reactions.attr.to; for n = i - 1, 1, -1 do - if not logs[n] then - break -- Probably reached logs[0] - elseif logs[n].key == target_id then + if logs[n].key == target_id then local react_map = logs[n].reactions; -- { string : integer } if not react_map then react_map = {};