Diff

mod_mam/mamprefs.lib.lua @ 2819:9ffb059c9ba5

mod_mam: Load archiving preferes for offline users (fixes #1024)
author Kim Alvefur <zash@zash.se>
date Tue, 17 Oct 2017 12:42:20 +0200
parent 2510:d81882aa0e1e
line wrap: on
line diff
--- a/mod_mam/mamprefs.lib.lua	Fri Nov 10 05:33:28 2017 +0100
+++ b/mod_mam/mamprefs.lib.lua	Tue Oct 17 12:42:20 2017 +0200
@@ -24,9 +24,11 @@
 local function get_prefs(user)
 	local user_sessions = sessions[user];
 	local user_prefs = user_sessions and user_sessions.archive_prefs
-	if not user_prefs and user_sessions then
+	if not user_prefs then
 		user_prefs = prefs:get(user);
-		user_sessions.archive_prefs = user_prefs;
+		if user_sessions then
+			user_sessions.archive_prefs = user_prefs;
+		end
 	end
 	return user_prefs or { [false] = global_default_policy };
 end