mod_pubsub: Prevent max_items from being set to zero
Disable persistence instead if no items should be persisted.
XEP-0060 is not entirely clear on what either of those option really
mean.
--- a/plugins/mod_pubsub/pubsub.lib.lua Tue Oct 19 18:11:50 2021 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua Wed Oct 20 17:31:24 2021 +0200
@@ -86,6 +86,7 @@
type = "text-single";
datatype = "pubsub:integer-or-max";
name = "max_items";
+ range_min = 1;
var = "pubsub#max_items";
label = "Max # of items to persist";
};
--- a/spec/scansion/pubsub_config.scs Tue Oct 19 18:11:50 2021 +0200
+++ b/spec/scansion/pubsub_config.scs Wed Oct 20 17:31:24 2021 +0200
@@ -48,7 +48,9 @@
<field var="pubsub#description" label="Description" type="text-single"/>
<field var="pubsub#type" label="The type of node data, usually specified by the namespace of the payload (if any)" type="text-single"/>
<field var="pubsub#max_items" label="Max # of items to persist" type="text-single">
- <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max"/>
+ <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max">
+ <range min="1"/>
+ </validate>
<value>1</value>
</field>
<field var="pubsub#persist_items" label="Persist items to storage" type="boolean">
@@ -136,7 +138,9 @@
<field var="pubsub#description" type="text-single" label="Description"/>
<field var="pubsub#type" type="text-single" label="The type of node data, usually specified by the namespace of the payload (if any)"/>
<field var="pubsub#max_items" type="text-single" label="Max # of items to persist">
- <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max"/>
+ <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max">
+ <range min="1"/>
+ </validate>
<value>1</value>
</field>
<field var="pubsub#persist_items" type="boolean" label="Persist items to storage">
--- a/spec/scansion/pubsub_max_items.scs Tue Oct 19 18:11:50 2021 +0200
+++ b/spec/scansion/pubsub_max_items.scs Wed Oct 20 17:31:24 2021 +0200
@@ -43,7 +43,9 @@
<field var="pubsub#description" label="Description" type="text-single"/>
<field var="pubsub#type" label="The type of node data, usually specified by the namespace of the payload (if any)" type="text-single"/>
<field var="pubsub#max_items" label="Max # of items to persist" type="text-single">
- <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max"/>
+ <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max">
+ <range min="1"/>
+ </validate>
<value>20</value>
</field>
<field var="pubsub#persist_items" label="Persist items to storage" type="boolean">
--- a/spec/scansion/pubsub_multi_items.scs Tue Oct 19 18:11:50 2021 +0200
+++ b/spec/scansion/pubsub_multi_items.scs Wed Oct 20 17:31:24 2021 +0200
@@ -43,7 +43,9 @@
<field var="pubsub#description" label="Description" type="text-single"/>
<field var="pubsub#type" label="The type of node data, usually specified by the namespace of the payload (if any)" type="text-single"/>
<field var="pubsub#max_items" label="Max # of items to persist" type="text-single">
- <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max"/>
+ <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max">
+ <range min="1"/>
+ </validate>
<value>20</value>
</field>
<field var="pubsub#persist_items" label="Persist items to storage" type="boolean">
--- a/spec/scansion/pubsub_preconditions.scs Tue Oct 19 18:11:50 2021 +0200
+++ b/spec/scansion/pubsub_preconditions.scs Wed Oct 20 17:31:24 2021 +0200
@@ -47,7 +47,9 @@
<field var="pubsub#description" label="Description" type="text-single"/>
<field var="pubsub#type" label="The type of node data, usually specified by the namespace of the payload (if any)" type="text-single"/>
<field var="pubsub#max_items" label="Max # of items to persist" type="text-single">
- <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max"/>
+ <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max">
+ <range min="1"/>
+ </validate>
<value>1</value>
</field>
<field var="pubsub#persist_items" label="Persist items to storage" type="boolean">
@@ -135,7 +137,9 @@
<field var="pubsub#description" type="text-single" label="Description"/>
<field var="pubsub#type" type="text-single" label="The type of node data, usually specified by the namespace of the payload (if any)"/>
<field var="pubsub#max_items" type="text-single" label="Max # of items to persist">
- <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max"/>
+ <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="pubsub:integer-or-max">
+ <range min="1"/>
+ </validate>
<value>1</value>
</field>
<field var="pubsub#persist_items" type="boolean" label="Persist items to storage">