diff mod_bookmarks2/mod_bookmarks2.lua @ 4845:6e17df6becec

mod_bookmarks2: Actually fix the right wrong codepath
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 04 Jan 2022 22:59:24 +0100
parents cc17708ba777
children ad7767a9f3ea
line wrap: on
line diff
--- a/mod_bookmarks2/mod_bookmarks2.lua	Tue Jan 04 22:57:06 2022 +0100
+++ b/mod_bookmarks2/mod_bookmarks2.lua	Tue Jan 04 22:59:24 2022 +0100
@@ -82,13 +82,8 @@
 	local service = mod_pep.get_pep_service(username);
 	local ok, ret = service:get_items(namespace, session.full_jid);
 	if not ok then
-		if ret == "item-not-found" then
-			module:log("debug", "Got no PEP bookmarks item for %s, returning empty legacy PEP bookmarks", jid);
-			session.send(st.reply(stanza):add_child(query));
-		else
-			module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret);
-			session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrive bookmarks from PEP"));
-		end
+		module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret);
+		session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrive bookmarks from PEP"));
 		return true;
 	end
 
@@ -122,8 +117,13 @@
 	local service = mod_pep.get_pep_service(username);
 	local ok, ret = service:get_items(namespace, session.full_jid);
 	if not ok then
-		module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret);
-		session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrive bookmarks from PEP"));
+		if ret == "item-not-found" then
+			module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid);
+			session.send(st.reply(stanza):add_child(query));
+		else
+			module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret);
+			session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrive bookmarks from PEP"));
+		end
 		return true;
 	end