mautrix / whatsapp

A Matrix-WhatsApp puppeting bridge
https://maunium.net/go/mautrix-whatsapp
GNU Affero General Public License v3.0
1.27k stars 172 forks source link

Invite the bridge bot to all bridged rooms #450

Closed CarlAmbroselli closed 2 years ago

CarlAmbroselli commented 2 years ago

All major Matrix clients I've tested (Element iOS, Element Web, FluffyChat) only display read markers with avatars if the account who sent the m.read event is a member of that room (invited but not accepted is enough).

The iMessage bridge does this, hence you can see the read receipt icon for every message that has been processed.

When delivery_receipts is set to true, the bridge also sends delivery receipts for the messages it processed, but this won't be displayed in matrix clients, because the bridge is not a member of the room.

Could we copy the behaviour of the iMessage bridge here and also invite the bridge account to all the bridged rooms?

CarlAmbroselli commented 2 years ago

Related issue on the Element iOS project: https://github.com/vector-im/element-ios/issues/5676

tulir commented 2 years ago

You can enable encryption to have the bridge bot in all rooms

CarlAmbroselli commented 2 years ago

Oh thanks tulir, that's of course trivial! Before I read your comment I already opened a PR to the element-ios client (https://github.com/vector-im/element-ios/pull/5685), if that merges then both options would work. I'll close this off here since there is a workaround!

CarlAmbroselli commented 2 years ago

@tulir I'd like to re-open this issue because: (a) I looked into the source code of element clients and they all rely on the event data fetched from room events to have information about the user that sent the read receipt. That works if the read receipt is sent from a user who is a member of the room, but it doesn't work if the user isn't a member of the room, because there is no information known about that "arbitrary" user from that context. (b) Sending read receipts should really also work for unencrypted rooms. There are many reasons why someone might want to not encrypt a room (i.e. because they want to use bots or other software that doesn't support encrypted rooms), so adding the bot to the room trivially fixes this.

Summary - would you accept a PR that adds the bot user to the room even if the room isn't encrypted @tulir?

CarlAmbroselli commented 2 years ago

Companion PR for telegram: https://github.com/mautrix/telegram/pull/766

CarlAmbroselli commented 2 years ago

Companion PR for facebook: https://github.com/mautrix/facebook/pull/222

CarlAmbroselli commented 2 years ago

Companion PR for signal: https://github.com/mautrix/signal/pull/229

CarlAmbroselli commented 2 years ago

Companion PR for google chat: https://github.com/mautrix/googlechat/pull/64

CarlAmbroselli commented 2 years ago

Companion PR for twitter: https://github.com/mautrix/twitter/pull/21

CarlAmbroselli commented 2 years ago

Companion PR for linkedin: https://gitlab.com/beeper/linkedin/-/merge_requests/48

CarlAmbroselli commented 2 years ago

PR for whatsapp: https://github.com/mautrix/whatsapp/pull/462/files

tulir commented 2 years ago

Probably not going to do this until canonical DMs happen. Making everything work properly is more complicated than just inviting the bot, and I don't really want to touch the current hacks.