hydrogen-web icon indicating copy to clipboard operation
hydrogen-web copied to clipboard

Peeking unknown rooms

Open ashfame opened this issue 2 years ago • 2 comments

👋 This PR introduces the preview/peeking functionality when you load an unknown room by directly going to the URL http://localhost:3000/#/session/3442497412902854/room/!wOlkWNmgkAZFxbTaqj%3Amatrix.org

When you land on this page, we check whether the room supports preview/peeking i.e. world_readable history visibility by showing a spinner in the UI:

Screenshot 2023-02-16 at 6 51 20 PM

Then if the room isn't preview-able, the spinner goes away and we are left with Unknown Room View exactly how it is prior to this PR. But in case, if its possible to preview the room messages, we fetch the 100 most recent messages from the homeserver and store them in indexedDB tables (timelineEvents and timelineFragments) as they would have been stored via sync response for a regular room. On every page load, the old messages stored in both tables are deleted and freshly fetched 100 messages are shown. Also when you are navigating away from a room, by clicking on another room from left sidebar, we delete the data from both tables that were fetched in context of peeking.

Screenshot 2023-02-16 at 6 59 51 PM

Currently back-scrolling works but it doesn't sync new messages i.e. doesn't show more messages as they come in, in the room. Also, the users are currently displayed as their matrix identity.

Looking forward to your review and happy to make any changes as needed to get this merged :)

ashfame avatar Feb 16 '23 15:02 ashfame

Related: https://github.com/vector-im/hydrogen-web/issues/719

psrpinto avatar Feb 16 '23 16:02 psrpinto

@MidhunSureshR This is now finished and ready for your review :)

ashfame avatar Feb 27 '23 11:02 ashfame