Fix runtime critical on incoming read marker

This would result in all messages being counted as unread and highlighted in the conversation list accordingly.
As of fa1ba2f8, there are no hidden content items for http file upload _messages_ anymore.
This commit is contained in:
fiaxh 2022-01-03 18:33:22 +01:00
parent 6b8ad7a104
commit 9e8b99e86c
1 changed files with 2 additions and 0 deletions

View File

@ -153,7 +153,9 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
if (conversation.read_up_to != null && conversation.read_up_to.local_time.compare(message.local_time) > 0) return;
conversation.read_up_to = message;
// TODO: This only marks messages as read, not http file transfers.
ContentItem? content_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item(conversation, 1, message.id);
if (content_item == null) return;
ContentItem? read_up_to_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item_by_id(conversation, conversation.read_up_to_item);
if (read_up_to_item != null && read_up_to_item.compare(content_item) > 0) return;
conversation.read_up_to_item = content_item.id;