From 9ba89e20b4273a9de409a017ba7d8c3543924d62 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 20 May 2018 03:27:02 +0200 Subject: util.pubsub: Don't record the superuser as owner on creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- util/pubsub.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'util') diff --git a/util/pubsub.lua b/util/pubsub.lua index 3a00aae5..65f6eee7 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -260,14 +260,16 @@ function service:create(node, actor, options) 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) -- cgit v1.2.3