Changeset

9122:a69dc9c729ec

mod_pubsub: Pass the current values to dataforms
author Kim Alvefur <zash@zash.se>
date Sun, 05 Aug 2018 15:52:19 +0200
parents 9121:e5eb36ee07a2
children 9125:da7a2db01d6a
files plugins/mod_pubsub/pubsub.lib.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Sun Aug 05 15:50:06 2018 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Sun Aug 05 15:52:19 2018 +0200
@@ -662,7 +662,12 @@
 		origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing dataform"));
 		return true;
 	end
-	local form_data, err = node_config_form:data(config_form);
+	local ok, old_config = service:get_node_config(node, stanza.attr.from);
+	if not ok then
+		origin.send(pubsub_error_reply(stanza, old_config));
+		return true;
+	end
+	local form_data, err = node_config_form:data(config_form, old_config);
 	if not form_data then
 		origin.send(st.error_reply(stanza, "modify", "bad-request", err));
 		return true;