Software /
code /
prosody
Comparison
spec/util_pubsub_spec.lua @ 11721:7a77f0c05382
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 22 Jul 2021 21:01:11 +0200 |
parent | 10573:3b8431eed785 |
child | 11723:3ead0967e04d |
comparison
equal
deleted
inserted
replaced
11720:72512c0858b3 | 11721:7a77f0c05382 |
---|---|
507 assert.spy(filter).was_called(); | 507 assert.spy(filter).was_called(); |
508 assert.spy(broadcaster).was_called(); | 508 assert.spy(broadcaster).was_called(); |
509 end); | 509 end); |
510 end); | 510 end); |
511 | 511 |
512 describe("persist_items", function() | |
513 it("can be disabled", function() | |
514 local broadcaster = spy.new(function(notif_type, node_name, subscribers, item) -- luacheck: ignore 212 | |
515 end); | |
516 local service = pubsub.new { node_defaults = { persist_items = false }, broadcaster = broadcaster } | |
517 | |
518 local ok = service:create("node", true) | |
519 assert.truthy(ok); | |
520 | |
521 local ok = service:publish("node", true, "1", "item"); | |
522 assert.truthy(ok); | |
523 assert.spy(broadcaster).was_called(); | |
524 | |
525 local ok, items = service:get_items("node", true); | |
526 assert.truthy(ok); | |
527 assert.same(items, {}); | |
528 end); | |
529 | |
530 end) | |
512 end); | 531 end); |