aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-08-06 08:21:55 +0100
committerMatthew Wild <mwild1@gmail.com>2018-08-06 08:21:55 +0100
commit21d71a3e21152e3015f9b6ef3bf6bb43a0218bf0 (patch)
tree8a905f8eee3e7772c11f811003d310094f78d6a2 /util
parent206ca2fd0d5e76f492b715fb801707bd7ed09282 (diff)
parentdb6c6745ebc9622aed762a892e81461cae9c154b (diff)
downloadprosody-21d71a3e21152e3015f9b6ef3bf6bb43a0218bf0.tar.gz
prosody-21d71a3e21152e3015f9b6ef3bf6bb43a0218bf0.zip
Merge with jonasw
Diffstat (limited to 'util')
-rw-r--r--util/dataforms.lua6
-rw-r--r--util/pubsub.lua4
2 files changed, 7 insertions, 3 deletions
diff --git a/util/dataforms.lua b/util/dataforms.lua
index a75e8db0..a5733b83 100644
--- a/util/dataforms.lua
+++ b/util/dataforms.lua
@@ -142,7 +142,7 @@ end
local field_readers = {};
-function form_t.data(layout, stanza)
+function form_t.data(layout, stanza, current)
local data = {};
local errors = {};
local present = {};
@@ -157,7 +157,9 @@ function form_t.data(layout, stanza)
end
if not tag then
- if field.required then
+ if current and current[field.name] ~= nil then
+ data[field.name] = current[field.name];
+ elseif field.required then
errors[field.name] = "Required value missing";
end
elseif field.name then
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);