mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix showing comments from the beginning.
This commit is contained in:
parent
1050447eed
commit
320adcd389
2 changed files with 20 additions and 14 deletions
|
@ -857,7 +857,12 @@ MsgId HistoryMessage::computeRepliesInboxReadTillFull() const {
|
||||||
? history()->owner().historyLoaded(
|
? history()->owner().historyLoaded(
|
||||||
peerFromChannel(views->commentsMegagroupId))
|
peerFromChannel(views->commentsMegagroupId))
|
||||||
: history().get();
|
: 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 {
|
MsgId HistoryMessage::repliesOutboxReadTill() const {
|
||||||
|
@ -891,7 +896,12 @@ MsgId HistoryMessage::computeRepliesOutboxReadTillFull() const {
|
||||||
? history()->owner().historyLoaded(
|
? history()->owner().historyLoaded(
|
||||||
peerFromChannel(views->commentsMegagroupId))
|
peerFromChannel(views->commentsMegagroupId))
|
||||||
: history().get();
|
: 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) {
|
void HistoryMessage::setRepliesMaxId(MsgId maxId) {
|
||||||
|
|
|
@ -354,24 +354,20 @@ void SessionNavigation::showRepliesForMessage(
|
||||||
if (const auto maxId = data.vmax_id()) {
|
if (const auto maxId = data.vmax_id()) {
|
||||||
item->setRepliesMaxId(maxId->v);
|
item->setRepliesMaxId(maxId->v);
|
||||||
}
|
}
|
||||||
if (const auto readTill = data.vread_inbox_max_id()) {
|
item->setRepliesInboxReadTill(
|
||||||
item->setRepliesInboxReadTill(readTill->v);
|
data.vread_inbox_max_id().value_or_empty());
|
||||||
}
|
item->setRepliesOutboxReadTill(
|
||||||
if (const auto readTill = data.vread_outbox_max_id()) {
|
data.vread_outbox_max_id().value_or_empty());
|
||||||
item->setRepliesOutboxReadTill(readTill->v);
|
|
||||||
}
|
|
||||||
const auto post = _session->data().message(channelId, rootId);
|
const auto post = _session->data().message(channelId, rootId);
|
||||||
if (post && item->history()->channelId() != channelId) {
|
if (post && item->history()->channelId() != channelId) {
|
||||||
post->setCommentsItemId(item->fullId());
|
post->setCommentsItemId(item->fullId());
|
||||||
if (const auto maxId = data.vmax_id()) {
|
if (const auto maxId = data.vmax_id()) {
|
||||||
post->setRepliesMaxId(maxId->v);
|
post->setRepliesMaxId(maxId->v);
|
||||||
}
|
}
|
||||||
if (const auto readTill = data.vread_inbox_max_id()) {
|
post->setRepliesInboxReadTill(
|
||||||
post->setRepliesInboxReadTill(readTill->v);
|
data.vread_inbox_max_id().value_or_empty());
|
||||||
}
|
post->setRepliesOutboxReadTill(
|
||||||
if (const auto readTill = data.vread_outbox_max_id()) {
|
data.vread_outbox_max_id().value_or_empty());
|
||||||
post->setRepliesOutboxReadTill(readTill->v);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
showSection(std::make_shared<HistoryView::RepliesMemento>(
|
showSection(std::make_shared<HistoryView::RepliesMemento>(
|
||||||
item,
|
item,
|
||||||
|
|
Loading…
Add table
Reference in a new issue