diff options
author | Kim Alvefur <zash@zash.se> | 2021-07-22 21:01:11 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-07-22 21:01:11 +0200 |
commit | ffeeffd35c4a274351804d9a8d40b9483830b0b6 (patch) | |
tree | f175fdba436d99b3c96f6b85e3fce5f27c847cc1 /spec | |
parent | 811613425828e4f4d89f6297886143663bce721c (diff) | |
download | prosody-ffeeffd35c4a274351804d9a8d40b9483830b0b6.tar.gz prosody-ffeeffd35c4a274351804d9a8d40b9483830b0b6.zip |
util.pubsub: Fix behavior of persist_items disabled
When set to 'false' there is no need for a persistence interface at all,
since items are not persisted after being broadcast.
Had started wondering if maybe the behavior was wrong, after reading
parts of XEP-0060 that pointed in that direction.
Some discussion of this can be found in logs of
xmpp:xsf@muc.xmpp.org?join from around 2021-07-20
Thanks to Ralph for confirming.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_pubsub_spec.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/util_pubsub_spec.lua b/spec/util_pubsub_spec.lua index f876089e..5140a411 100644 --- a/spec/util_pubsub_spec.lua +++ b/spec/util_pubsub_spec.lua @@ -509,4 +509,23 @@ describe("util.pubsub", function () end); end); + describe("persist_items", function() + it("can be disabled", function() + local broadcaster = spy.new(function(notif_type, node_name, subscribers, item) -- luacheck: ignore 212 + end); + local service = pubsub.new { node_defaults = { persist_items = false }, broadcaster = broadcaster } + + local ok = service:create("node", true) + assert.truthy(ok); + + local ok = service:publish("node", true, "1", "item"); + assert.truthy(ok); + assert.spy(broadcaster).was_called(); + + local ok, items = service:get_items("node", true); + assert.truthy(ok); + assert.same(items, {}); + end); + + end) end); |