prose-im / prose-core-client

Prose core XMPP client manager & protocols.
https://prose.org
Mozilla Public License 2.0
23 stars 3 forks source link

Merge older fastenings from the cache when paging through a conversation #59

Closed nesium closed 9 months ago

nesium commented 9 months ago

When the user scrolls through a conversation we're loading every message from MAM up to the requested point.

The order is always from newest to oldest. Each loaded page of messages is then saved to the cache. Due to the nature of XMPP all messages are loaded in a stream where newer messages can reference older messages, e.g. a reaction to an older message results in a new message carrying the reaction.

When scrolling further up to see older messages the core lib should fetch the newer - already loaded - messages from the cache that reference the loaded older messages to reduce them into their final state: A single message object that contains all read markers, reactions and so on.

This approach works perfectly fine for this use case but would not work for displaying an older message when the newer messages have not been loaded before. To handle this second case efficiently we'd need server support as mentioned in prose-im/prose-pod-system#10, but that is out of scope for this issue.

Also refs prose-im/prose-app-web#56