Fix mistake in receipt sending

And possible mistake in member kicking
This commit is contained in:
Andrew Ferrazzutti 2021-06-06 18:19:36 -04:00
parent c89c59e7fc
commit 11ba99e17b
1 changed files with 5 additions and 4 deletions

View File

@ -349,9 +349,10 @@ class Portal(DBPortal, BasePortal):
if reaction: if reaction:
await self.main_intent.redact(self.mxid, reaction.mxid) await self.main_intent.redact(self.mxid, reaction.mxid)
await reaction.delete() await reaction.delete()
# TODO Not just -1 if there are multiple _OWN_ puppets...
if receipt_count == len(self._last_participant_update) - 1: if receipt_count == len(self._last_participant_update) - 1:
for participant in self._last_participant_update: 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.id) puppet = await p.Puppet.get_by_mid(participant)
await puppet.intent.send_receipt(self.mxid, event_id) await puppet.intent.send_receipt(self.mxid, event_id)
else: else:
# TODO Translatable string for "Read by" # TODO Translatable string for "Read by"
@ -477,10 +478,10 @@ class Portal(DBPortal, BasePortal):
# Make sure puppets who should be here are here # Make sure puppets who should be here are here
for participant in participants: 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): if forbid_own_puppets and p.Puppet.is_mid_for_own_puppet(participant.id):
continue 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) print(current_members)