tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Channels lastReadOutboxMessageId bug #2496

Closed Fra078 closed 1 year ago

Fra078 commented 1 year ago

Channels where you can't send messages have lastReadOutboxMessageId very high so trying to display in a message list the max between lastReadOutboxMessageId and lastReadInboxMessageId result always as lastReadOutboxMessageId. So the message list starts always from the bottom

levlam commented 1 year ago

lastReadOutboxMessageId shouldn't be used to determine chat opening position. Use just lastReadInboxMessageId and skip returned outgoing messages right after the lastReadInboxMessageId if any.

The lastReadOutboxMessageId and lastReadInboxMessageId are just identifiers, before which all messages are read. There could be no corresponding message.

Fra078 commented 1 year ago

But if I use these variables also to determine where I have to display the Text (Unread messages) so I have to use both to avoid putting outbox messages under this text. wouldn't it be better to insert a variable like "lastReadMessageId"?

levlam commented 1 year ago

You always open the chat from lastReadInboxMessageId and to place the bar correctly you need to skip outgoing messages after the last read inbox position. The skipped outgoing messages may or may not be read by peers, so it is useless to check lastReadOutboxMessageId.