Double-puppeted user leaving relaybotted Telegram group causes non-propagated messages
Steps to reproduce:
- User logins to the bridge
- User joins a matrix room which is relaybotted by the same mautrix-telegram instance
- User leaves the room from Telegram
- User writes to the Matrix room
- Messages are not relaybotted to Telegram
What should happen:
- Message is relayed to Telegram using the relaybot
The only way to fix this currently seems to be manipulating the database directly like this: DELETE FROM user_portal where "user"=user_id and portal=portal_id;.
This issue has been briefly discussed on the chat room on 2022-01-19.
Since leaving the Telegram chat caused inconsistencies, I think that the solution should be to bridge the leave from Telegram to matrix (via double puppeting). Alternatively, the relaybot could re-invite the user to Telegram, but that's hardly the intention the user had when they left the group.
To achieve what you're promoting, you probably need to bridge the event if the user leaving the chat by running this function: https://github.com/mautrix/telegram/blob/436781215f55fa8c73aa348985c7687930e11712/mautrix_telegram/user.py#L919
Which probably isn't too hard to do if you can figure out how Telegram expresses said event.