Changeset

8809:6cba2df3817c

util.pubsub: Don't record the superuser as owner on creation No need to be set as owner, it has all privileges anyways. Since it’s a boolean instead of a string, its presence may cause weirdness in other code expecting all affiliations to be string JIDs.
author Kim Alvefur <zash@zash.se>
date Sun, 20 May 2018 03:27:02 +0200
parents 8808:40a7135eb6ac
children 8810:9f8a746f99c1
files util/pubsub.lua
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/util/pubsub.lua	Mon May 21 01:25:10 2018 +0200
+++ b/util/pubsub.lua	Sun May 20 03:27:02 2018 +0200
@@ -260,14 +260,16 @@
 
 	self.data[node] = self.config.itemstore(self.nodes[node].config, node);
 	self.events.fire_event("node-created", { node = node, actor = actor });
-	local ok, err = self:set_affiliation(node, true, actor, "owner");
-	if not ok then
-		self.nodes[node] = nil;
-		self.data[node] = nil;
-		return ok, err;
+	if actor ~= true then
+		local ok, err = self:set_affiliation(node, true, actor, "owner");
+		if not ok then
+			self.nodes[node] = nil;
+			self.data[node] = nil;
+			return ok, err;
+		end
 	end
 
-	return ok, err;
+	return true;
 end
 
 function service:delete(node, actor)