changeset 3807:2032826cfbcf

component AP gateway typing + remove unused `activity` arg from `newAPDeleteItem` rel 367
author Goffi <goffi@goffi.org>
date Fri, 17 Jun 2022 15:50:34 +0200
parents adebd8036b68
children 39fc2e1b3793
files sat/plugins/plugin_comp_ap_gateway/__init__.py sat/plugins/plugin_comp_ap_gateway/http_server.py
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_ap_gateway/__init__.py	Fri Jun 17 15:50:15 2022 +0200
+++ b/sat/plugins/plugin_comp_ap_gateway/__init__.py	Fri Jun 17 15:50:34 2022 +0200
@@ -42,7 +42,7 @@
 from twisted.web import http
 from twisted.words.protocols.jabber import error, jid
 from twisted.words.xish import domish
-from wokkel import rsm
+from wokkel import rsm, pubsub
 
 from sat.core import exceptions
 from sat.core.constants import Const as C
@@ -232,7 +232,11 @@
         client.sendHistory = True
         await self.init(client)
 
-    async def _itemsReceived(self, client, itemsEvent):
+    async def _itemsReceived(
+        self,
+        client: SatXMPPEntity,
+        itemsEvent: pubsub.ItemsEvent
+    ) -> None:
         """Callback called when pubsub items are received
 
         if the items are adressed to a JID corresponding to an AP actor, they are
@@ -930,6 +934,10 @@
     async def getAPActorIdFromAccount(self, account: str) -> str:
         """Retrieve account ID from it's handle using WebFinger
 
+        Don't use this method to get local actor id from a local account derivated for
+        JID: in this case, the actor ID is retrieve with
+        ``self.buildAPURL(TYPE_ACTOR, ap_account)``
+
         @param account: AP handle (user@domain.tld)
         @return: Actor ID (which is an URL)
         """
@@ -1898,7 +1906,6 @@
         client: SatXMPPEntity,
         destinee: Optional[jid.JID],
         node: str,
-        activity: dict,
         item: dict,
     ) -> None:
         """Analyse, cache and send notification for received AP item
@@ -1931,7 +1938,7 @@
             # it's a direct message
             if history.source_jid != client.jid:
                 log.warning(
-                    f"retractation received from an entity ''{client.jid}) which is "
+                    f"retraction received from an entity ''{client.jid}) which is "
                     f"not the original sender of the message ({history.source_jid}), "
                     "hack attemps?"
                 )
--- a/sat/plugins/plugin_comp_ap_gateway/http_server.py	Fri Jun 17 15:50:15 2022 +0200
+++ b/sat/plugins/plugin_comp_ap_gateway/http_server.py	Fri Jun 17 15:50:34 2022 +0200
@@ -252,7 +252,7 @@
         client = await self.apg.getVirtualClient(signing_actor)
         objects = await self.apg.apGetList(data, "object")
         for obj in objects:
-            await self.apg.newAPDeleteItem(client, account_jid, node, data, obj)
+            await self.apg.newAPDeleteItem(client, account_jid, node, obj)
 
     async def handleCreateActivity(
         self,