diff options
author | Kim Alvefur <zash@zash.se> | 2018-08-05 15:17:00 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-08-05 15:17:00 +0200 |
commit | 54ad49947952b9973d5a38a6852bf8344db4b852 (patch) | |
tree | 8afe8cb868fee93d5b80fce443e63bb8feb6348c /util/pubsub.lua | |
parent | d77fe6c4d39d88756c5a126dbc081dd27957b6a4 (diff) | |
download | prosody-54ad49947952b9973d5a38a6852bf8344db4b852.tar.gz prosody-54ad49947952b9973d5a38a6852bf8344db4b852.zip |
util.pubsub: Apply defaults metatable before config check (thanks pep.)
Makes it so that the callback sees the default if it?s not in the form,
which makes it easier to validate.
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r-- | util/pubsub.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua index 381c449a..964b26c7 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -565,6 +565,8 @@ function service:set_node_config(node, actor, new_config) return false, "item-not-found"; end + setmetatable(new_config, {__index=self.node_defaults}) + if self.config.check_node_config then local ok = self.config.check_node_config(node, actor, new_config); if not ok then @@ -573,7 +575,7 @@ function service:set_node_config(node, actor, new_config) end local old_config = node_obj.config; - node_obj.config = setmetatable(new_config, {__index=self.node_defaults}); + node_obj.config = new_config; if self.config.nodestore then local ok, err = save_node_to_store(self, node_obj); |