mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix opening topic first time, jump down on second click.
This commit is contained in:
parent
57dc0c632e
commit
f6e501a431
2 changed files with 25 additions and 10 deletions
|
@ -452,6 +452,7 @@ void ListWidget::refreshRows(const Data::MessagesSlice &old) {
|
|||
1
|
||||
) - 1;
|
||||
|
||||
auto destroyingBarElement = _bar.element;
|
||||
_items.clear();
|
||||
_items.reserve(_slice.ids.size());
|
||||
auto nearestIndex = -1;
|
||||
|
@ -460,9 +461,17 @@ void ListWidget::refreshRows(const Data::MessagesSlice &old) {
|
|||
if (_slice.nearestToAround == fullId) {
|
||||
nearestIndex = int(_items.size());
|
||||
}
|
||||
_items.push_back(enforceViewForItem(item));
|
||||
const auto view = enforceViewForItem(item);
|
||||
_items.push_back(view);
|
||||
if (destroyingBarElement == view) {
|
||||
destroyingBarElement = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (destroyingBarElement) {
|
||||
destroyingBarElement->destroyUnreadBar();
|
||||
_bar = {};
|
||||
}
|
||||
for (auto e = end(_items), i = e - addedToEndCount; i != e; ++i) {
|
||||
_itemRevealPending.emplace(*i);
|
||||
}
|
||||
|
|
|
@ -164,13 +164,6 @@ void RepliesMemento::setReadInformation(
|
|||
}
|
||||
_replies->setInboxReadTill(inboxReadTillId, unreadCount);
|
||||
_replies->setOutboxReadTill(outboxReadTillId);
|
||||
if (!_list.aroundPosition().fullId
|
||||
&& _replies->computeInboxReadTillFull() == MsgId(1)) {
|
||||
_list.setAroundPosition(Data::MinMessagePosition);
|
||||
_list.setScrollTopState(ListMemento::ScrollTopState{
|
||||
Data::MinMessagePosition
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
object_ptr<Window::SectionWidget> RepliesMemento::createWidget(
|
||||
|
@ -181,6 +174,14 @@ object_ptr<Window::SectionWidget> RepliesMemento::createWidget(
|
|||
if (column == Window::Column::Third) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!_list.aroundPosition().fullId
|
||||
&& _replies
|
||||
&& _replies->computeInboxReadTillFull() == MsgId(1)) {
|
||||
_list.setAroundPosition(Data::MinMessagePosition);
|
||||
_list.setScrollTopState(ListMemento::ScrollTopState{
|
||||
Data::MinMessagePosition
|
||||
});
|
||||
}
|
||||
auto result = object_ptr<RepliesWidget>(
|
||||
parent,
|
||||
controller,
|
||||
|
@ -1886,6 +1887,9 @@ bool RepliesWidget::showInternal(
|
|||
if (logMemento->getHistory() == history()
|
||||
&& logMemento->getRootId() == _rootId) {
|
||||
restoreState(logMemento);
|
||||
if (!logMemento->getHighlightId()) {
|
||||
showAtPosition(Data::UnreadMessagePosition);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2073,9 +2077,11 @@ void RepliesWidget::updateControlsGeometry() {
|
|||
|
||||
const auto newScrollTop = _scroll->isHidden()
|
||||
? std::nullopt
|
||||
: base::make_optional(_scroll->scrollTop()
|
||||
: _scroll->scrollTop()
|
||||
? base::make_optional(_scroll->scrollTop()
|
||||
+ topDelta()
|
||||
+ _scrollTopDelta);
|
||||
+ _scrollTopDelta)
|
||||
: 0;
|
||||
_topBar->resizeToWidth(contentWidth);
|
||||
_topBarShadow->resize(contentWidth, st::lineWidth);
|
||||
if (_rootView) {
|
||||
|
|
Loading…
Add table
Reference in a new issue