component AP gateway typing + remove unused activity arg from newAPDeleteItem

rel 367
This commit is contained in:
Goffi 2022-06-17 15:50:34 +02:00
commit c02dcf3d94
2 changed files with 12 additions and 5 deletions

View file

@ -42,7 +42,7 @@ from twisted.internet import defer, reactor, threads
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 @@ class APGateway:
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 @@ class APGateway:
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 @@ class APGateway:
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 @@ class APGateway:
# 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?"
)

View file

@ -252,7 +252,7 @@ class HTTPAPGServer(web_resource.Resource):
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,