gluon-config-mode-contact-info: restore datatype definition

optional = true does not make sense without a datatype. When no datatype is
set, the empty string will be a valid value, so data is never unset in the
write function. Restore the minlength(1) datatype so the contact setting is
deleted as intended when no value is provided.
This commit is contained in:
Matthias Schiffer 2018-06-04 23:37:32 +02:00
parent b8fa1b2a99
commit 603912dd0d
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -16,6 +16,7 @@ return function(form, uci)
local o = s:option(Value, "contact", pkg_i18n.translate("Contact info"), pkg_i18n.translate("e.g. E-mail or phone number")) local o = s:option(Value, "contact", pkg_i18n.translate("Contact info"), pkg_i18n.translate("e.g. E-mail or phone number"))
o.default = uci:get("gluon-node-info", owner, "contact") o.default = uci:get("gluon-node-info", owner, "contact")
o.datatype = 'minlength(1)'
o.optional = true o.optional = true
function o:write(data) function o:write(data)
uci:set("gluon-node-info", owner, "contact", data) uci:set("gluon-node-info", owner, "contact", data)