Changeset

9089:3a7a0b9f42f3

util.dataforms: Skip all fields for the 'cancel' form type XEP-0004 says: > a data form of type "cancel" SHOULD NOT contain any <field/> elements. The title and instructions don't seem to be of much value in this case either. I'm not aware of 'cancel' being used anywhere, so this should break nothing. Early return is always nice.
author Kim Alvefur <zash@zash.se>
date Fri, 03 Aug 2018 21:06:59 +0200
parents 9088:aa1b02411846
children 9090:56c52cb4d44e
files util/dataforms.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/dataforms.lua	Fri Aug 03 21:05:48 2018 +0200
+++ b/util/dataforms.lua	Fri Aug 03 21:06:59 2018 +0200
@@ -28,6 +28,9 @@
 function form_t.form(layout, data, formtype)
 	if not formtype then formtype = "form" end
 	local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype });
+	if formtype == "cancel" then
+		return form;
+	end
 	if layout.title then
 		form:tag("title"):text(layout.title):up();
 	end