Description
When inviting a user to an E2EE room with history visibility set to allow the new user to view historical messages, we now share (some) decryption keys with the invited user. However, even after doing so, sometimes the new user will see a blank room when they join. They can view the messages after switching to a different room and then switching back.
This is due to matrix-org/matrix-react-sdk#3881, which filters out UTDs from the timeline if they are from before the user joined the room. Thus, if the invited user's Element tries to display the timeline before it receives/processes the keys, it will not try to re-display the undecryptable messages.
I think that we can fix this by modifying https://github.com/matrix-org/matrix-react-sdk/pull/3881/files so that, instead of removing the undecryptable event tiles from the timeline, it just hides them or leaves them blank. When the keys come in, it re-tries the decryption (using the normal decryption re-try mechanism), and if the decryption is successful, then it should back-paginate a few events, and either hide these events and stop back-paginating (if undecryptable), or show them back-paginate more (if decryptable).
Note: I think that this exceeds my React knowledge, so hopefully someone else can pick it up.
You can't see earlier messages
Encrypted messages before this point are unavailable