diff sat_pubsub/privilege.py @ 462:a017af61a32b

privilege: add server JID to `publisher` so `+notify` works with it: the server's PEP itself is now working as other PEP accounts, i.e. notification of last published message are sent on presence received when `+notify` is used.
author Goffi <goffi@goffi.org>
date Fri, 15 Oct 2021 09:32:07 +0200
parents 607616f9ef5b
children f520ac3164b0
line wrap: on
line diff
--- a/sat_pubsub/privilege.py	Fri Oct 15 09:32:07 2021 +0200
+++ b/sat_pubsub/privilege.py	Fri Oct 15 09:32:07 2021 +0200
@@ -292,8 +292,12 @@
             nodes = tuple(self.hash_map[disco_tuple]['notify'])
             if not nodes:
                 return
-            # publishers are entities which have granted presence access to our user + user itself
-            publishers = tuple(self.presence_map.get(from_jid_bare, ())) + (from_jid_bare,)
+            # publishers are entities which have granted presence access to our user
+            # + user itself + server
+            publishers = (
+                tuple(self.presence_map.get(from_jid_bare, ()))
+                + (from_jid_bare, self.backend.server_jid)
+            )
 
             # FIXME: add "presence" access_model (for node) for getLastItems
             last_items = yield self._backend.storage.getLastItems(publishers, nodes, ('open',), ('open',), True)