summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Preston <johnprestonmail@gmail.com>2021-03-29 19:53:55 +0400
committerJohn Preston <johnprestonmail@gmail.com>2021-03-29 19:53:55 +0400
commit78def16ced5096f930f8d88adb00fe125cf80e73 (patch)
tree88345ec4cfc5fccfdea053118f7e1b930a8df1d8
parentcd7b3419dea069abb382e396554058ae129b47ef (diff)
Fix showing comments from the beginning.
-rw-r--r--Telegram/SourceFiles/history/history_message.cpp14
-rw-r--r--Telegram/SourceFiles/window/window_session_controller.cpp20
2 files changed, 20 insertions, 14 deletions
diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp
index 6e01d56814..c79bc2ae69 100644
--- a/Telegram/SourceFiles/history/history_message.cpp
+++ b/Telegram/SourceFiles/history/history_message.cpp
@@ -857,7 +857,12 @@ MsgId HistoryMessage::computeRepliesInboxReadTillFull() const {
? history()->owner().historyLoaded(
peerFromChannel(views->commentsMegagroupId))
: history().get();
- return group ? std::max(local, group->inboxReadTillId()) : local;
+ if (const auto megagroup = group->peer->asChannel()) {
+ if (megagroup->amIn()) {
+ return std::max(local, group->inboxReadTillId());
+ }
+ }
+ return local;
}
MsgId HistoryMessage::repliesOutboxReadTill() const {
@@ -891,7 +896,12 @@ MsgId HistoryMessage::computeRepliesOutboxReadTillFull() const {
? history()->owner().historyLoaded(
peerFromChannel(views->commentsMegagroupId))
: history().get();
- return group ? std::max(local, group->outboxReadTillId()) : local;
+ if (const auto megagroup = group->peer->asChannel()) {
+ if (megagroup->amIn()) {
+ return std::max(local, group->outboxReadTillId());
+ }
+ }
+ return local;
}
void HistoryMessage::setRepliesMaxId(MsgId maxId) {
diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp
index ecdf58d53e..4d37527dd8 100644
--- a/Telegram/SourceFiles/window/window_session_controller.cpp
+++ b/Telegram/SourceFiles/window/window_session_controller.cpp
@@ -354,24 +354,20 @@ void SessionNavigation::showRepliesForMessage(
if (const auto maxId = data.vmax_id()) {
item->setRepliesMaxId(maxId->v);
}
- if (const auto readTill = data.vread_inbox_max_id()) {
- item->setRepliesInboxReadTill(readTill->v);
- }
- if (const auto readTill = data.vread_outbox_max_id()) {
- item->setRepliesOutboxReadTill(readTill->v);
- }
+ item->setRepliesInboxReadTill(
+ data.vread_inbox_max_id().value_or_empty());
+ item->setRepliesOutboxReadTill(
+ data.vread_outbox_max_id().value_or_empty());
const auto post = _session->data().message(channelId, rootId);
if (post && item->history()->channelId() != channelId) {
post->setCommentsItemId(item->fullId());
if (const auto maxId = data.vmax_id()) {
post->setRepliesMaxId(maxId->v);
}
- if (const auto readTill = data.vread_inbox_max_id()) {
- post->setRepliesInboxReadTill(readTill->v);
- }
- if (const auto readTill = data.vread_outbox_max_id()) {
- post->setRepliesOutboxReadTill(readTill->v);
- }
+ post->setRepliesInboxReadTill(
+ data.vread_inbox_max_id().value_or_empty());
+ post->setRepliesOutboxReadTill(
+ data.vread_outbox_max_id().value_or_empty());
}
showSection(std::make_shared<HistoryView::RepliesMemento>(
item,