mod_http_muc_log: Remove dead code
authorKim Alvefur <zash@zash.se>
Tue, 16 Aug 2022 01:27:59 +0200
changeset 4993 b74d592df9e2
parent 4992 732229fe68ab
child 4994 d55b10878e43
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.
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 = {};