Diff

plugins/mod_mam/mod_mam.lua @ 12860:38b3cd292ee5

Merge 0.12->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 21 Jan 2023 17:18:16 +0100
parent 12630:781772c8b6d9
parent 12857:cc86d77481fc
child 12977:74b9e05af71e
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Fri Jan 20 23:40:54 2023 +0100
+++ b/plugins/mod_mam/mod_mam.lua	Sat Jan 21 17:18:16 2023 +0100
@@ -142,9 +142,14 @@
 	local qset = rsm.get(query);
 	local qmax = m_min(qset and qset.max or default_max_items, max_max_items);
 	local reverse = qset and qset.before or false;
+
 	local before, after = qset and qset.before or qbefore, qset and qset.after or qafter;
 	if type(before) ~= "string" then before = nil; end
 
+	-- A reverse query needs to be flipped
+	local flip = reverse;
+	-- A flip-page query needs to be the opposite of that.
+	if query:get_child("flip-page") then flip = not flip end
 
 	module:log("debug", "Archive query by %s id=%s with=%s when=%s...%s rsm=%q",
 		origin.username,
@@ -154,11 +159,6 @@
 		qend and timestamp(qend) or "",
 		qset);
 
-	-- A reverse query needs to be flipped
-	local flip = reverse;
-	-- A flip-page query needs to be the opposite of that.
-	if query:get_child("flip-page") then flip = not flip end
-
 	-- Load all the data!
 	local data, err = archive:find(origin.username, {
 		start = qstart; ["end"] = qend; -- Time range