JojiiOfficial / Matrix-EmailBridge

A bridge written in Golang to receive and write emails in matrix
BSD 2-Clause "Simplified" License
122 stars 14 forks source link

EmailBridge does not work in a specific room #28

Closed bpcurse closed 4 years ago

bpcurse commented 4 years ago

I have encountered a rather strange behavior probably after updating to the latest git version. EmailBridge is working nicely in a pre-existing room and in a room created after the update, but it stopped working in another pre-existing room.

Unfortunately I cannot recreate the circumstances that led to the issue. The only thing that is different - but I can't really imagine how this should be involved - I have invited another user to the affected room and given this user power level 100.

What happens?

How I tried to fix it:

@JojiiOfficial Do you have any idea what I could do to troubleshoot this situation?

JojiiOfficial commented 4 years ago

Does the logs contain something suspicious or some errors when this behavior appears? Does it work if you kick the user and the bot from the room and invite the bot again? Does inviting the bot into a new room work?

bpcurse commented 4 years ago

Does inviting the bot into a new room work?

Yes it does. It shows the welcome message and reacts to the !help and !login commands correctly.

Does it work if you kick the user and the bot from the room and invite the bot again?

I did log in as the new power level 100 user and left the room (this user is a global synapse admin, too). Interestingly the email bot left immediately together with the new admin user, so this probably is somehow connected :thinking: I guess it is not intended that the bot follows a certain user "to the exit" :wink: Maybe some weird synapse issue? I could reinvite the bot and it joined the room, but it still does not respond to commands.

Does the logs contain something suspicious or some errors when this behavior appears?

The log does not show room invites to the bot (but that is another issue). There is no error logged.

As a workaround I will simply close the room and use another one instead. In every other room it works fine. If the exact steps necessary to reproduce this issue can be identified, I will report them here.

JojiiOfficial commented 4 years ago

If a non bot user leaves a room, the bot gets kicked. This was implemented to avoid empty rooms with only the bot in it.

I'll try to reproduce your bug with the information you gave me. Otherwise if you get any further information/bugs, tell me.

bpcurse commented 4 years ago

If the bot leaves every time a non bot user leaves the room, this behavior should be reevaluated for rooms with multiple users. The bot should not exit if there are still users left in the room.

JojiiOfficial commented 4 years ago

Yes you're right. I'll change this in future commits.

bpcurse commented 4 years ago

I've identified the problem. It was me :see_no_evil:

Quite simple cause: To prevent users from posting in this "receive emails only" room, I've set the necessary power level to send messages to Moderator (50) which was not assigned to the bot.

Happy holidays! :christmas_tree: