element-hq / element-desktop

A glossy Matrix collaboration client for desktop.
https://element.io
GNU Affero General Public License v3.0
1.16k stars 266 forks source link

Use local seshat index for backscroll/backfill instead of hitting the server #911

Open dylangerdaly opened 2 years ago

dylangerdaly commented 2 years ago

Your use case

What would you like to do?

Instead of hitting the server for events, why not use the local seshat index when backscrolling in an E2EE room if you have seshat enabled?

Why would you like to do it?

How would you like to achieve it?

Take some of the search logic and use it to get events instead of issuing requests to the server if E2EE is enabled and the user has seshat.

Have you considered any alternatives?

None

Additional context

Nil

dylangerdaly commented 2 years ago

Would it be possible to simply hook the /backfill request?

t3chguy commented 2 years ago

It'd only work when Seshat is fully synced up, given edits, reactions, redactions, threads etc all affect what the server returns over the /messages api for backfill. Itd also need quite a few changes in Seshat which is intended as an fts index only right now.

dylangerdaly commented 2 years ago

Would it be possible for you to point me in the right direction in terms of what files to edit? I've changed the after/before search from 2 to 50 giving me more context when I search.

I don't mind this being 'hacky'

-------- Original Message -------- On May 12, 2022, 4:27 PM, Michael Telatynski wrote:

It'd only work when Seshat is fully synced up, given edits, reactions, redactions, threads etc all affect what the server returns over the /messages api for backfill. Itd also need quite a few changes in Seshat which is intended as an fts index only right now.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

t3chguy commented 2 years ago

https://github.com/matrix-org/seshat would need a whole new API for matching the /messages request for backfill You'd need something like https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/indexing/EventIndex.ts to hook into /messages