From c880dee2af4b1f5e184c3a3c7f70036694d9c1f8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 9 Jun 2021 15:58:49 +0200 Subject: mod_pubsub,mod_pep: Support "max" as 'pubsub#max_items' Fixes #1643 API change: The argument to archive_itemstore() changes type to integer --- plugins/mod_pubsub/pubsub.lib.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'plugins/mod_pubsub/pubsub.lib.lua') diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index b53e0689..e7fa715d 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -83,7 +83,7 @@ local node_config_form = dataform { }; { type = "text-single"; - datatype = "xs:integer"; + datatype = "pubsub:integer-or-max"; name = "max_items"; var = "pubsub#max_items"; label = "Max # of items to persist"; @@ -801,10 +801,9 @@ local function create_encapsulating_item(id, payload) return item; end -local function archive_itemstore(archive, config, user, node) - module:log("debug", "Creation of archive itemstore for node %s with config %q", node, config); +local function archive_itemstore(archive, max_items, user, node) + module:log("debug", "Creation of archive itemstore for node %s with limit %d", node, max_items); local get_set = {}; - local max_items = config["max_items"]; function get_set:items() -- luacheck: ignore 212/self local data, err = archive:find(user, { limit = tonumber(max_items); -- cgit v1.2.3