# HG changeset patch # User Goffi # Date 1658419520 -7200 # Node ID 37d2c0282304fea726679c6fcc59eeafa69b07fc # Parent c3e6c54660daa20f60d1db41008360b8aa416e6b component AP gateway (pubsub): only emit a `Follow` activity for microblog subscription: this avoid to emit Follow subscription when an entity wants to subscribe to attachments or other special nodes. rel 370 diff -r c3e6c54660da -r 37d2c0282304 sat/plugins/plugin_comp_ap_gateway/pubsub_service.py --- a/sat/plugins/plugin_comp_ap_gateway/pubsub_service.py Thu Jul 21 18:02:33 2022 +0200 +++ b/sat/plugins/plugin_comp_ap_gateway/pubsub_service.py Thu Jul 21 18:05:20 2022 +0200 @@ -478,17 +478,19 @@ f"unmanaged subscription state: {subscription.state}" ) - req_actor_id, recip_actor_id, inbox = await self.getAPActorIdsAndInbox( - requestor, service - ) - - data = self.apg.createActivity("Follow", req_actor_id, recip_actor_id) + if nodeIdentifier == self.apg._m.namespace: + # if we subscribe to microblog node, we follow the corresponding account + req_actor_id, recip_actor_id, inbox = await self.getAPActorIdsAndInbox( + requestor, service + ) - resp = await self.apg.signAndPost(inbox, req_actor_id, data) - if resp.code >= 300: - text = await resp.text() - raise error.StanzaError("service-unavailable", text=text) - return pubsub.Subscription(nodeIdentifier, requestor, "subscribed") + data = self.apg.createActivity("Follow", req_actor_id, recip_actor_id) + + resp = await self.apg.signAndPost(inbox, req_actor_id, data) + if resp.code >= 300: + text = await resp.text() + raise error.StanzaError("service-unavailable", text=text) + return pubsub.Subscription(nodeIdentifier, requestor, "subscribed") @ensure_deferred async def unsubscribe(self, requestor, service, nodeIdentifier, subscriber):