From 11ba99e17b441d5c5b80e71c00f7a14edf9fbcd2 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Sun, 6 Jun 2021 18:19:36 -0400 Subject: [PATCH] Fix mistake in receipt sending And possible mistake in member kicking --- matrix_puppeteer_line/portal.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/matrix_puppeteer_line/portal.py b/matrix_puppeteer_line/portal.py index b46f0c7..899a112 100644 --- a/matrix_puppeteer_line/portal.py +++ b/matrix_puppeteer_line/portal.py @@ -349,9 +349,10 @@ class Portal(DBPortal, BasePortal): if reaction: await self.main_intent.redact(self.mxid, reaction.mxid) await reaction.delete() + # TODO Not just -1 if there are multiple _OWN_ puppets... if receipt_count == len(self._last_participant_update) - 1: - for participant in self._last_participant_update: - puppet = await p.Puppet.get_by_mid(participant.id) + for participant in filter(lambda participant: not p.Puppet.is_mid_for_own_puppet(participant), self._last_participant_update): + puppet = await p.Puppet.get_by_mid(participant) await puppet.intent.send_receipt(self.mxid, event_id) else: # TODO Translatable string for "Read by" @@ -477,10 +478,10 @@ class Portal(DBPortal, BasePortal): # Make sure puppets who should be here are here for participant in participants: - puppet = await p.Puppet.get_by_mid(participant.id) if forbid_own_puppets and p.Puppet.is_mid_for_own_puppet(participant.id): continue - await puppet.intent.ensure_joined(self.mxid) + intent = (await p.Puppet.get_by_mid(participant.id)).intent + await intent.ensure_joined(self.mxid) print(current_members)