diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 188d11338..6c989fd1e 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -58,11 +58,19 @@ namespace HistoryView { ScheduledMemento::ScheduledMemento(not_null history) : _history(history) , _forumTopic(nullptr) { + const auto list = _history->owner().scheduledMessages().list(_history); + if (!list.ids.empty()) { + _list.setScrollTopState({ .item = { .fullId = list.ids.front() } }); + } } ScheduledMemento::ScheduledMemento(not_null forumTopic) : _history(forumTopic->owningHistory()) , _forumTopic(forumTopic) { + const auto list = _history->owner().scheduledMessages().list(_forumTopic); + if (!list.ids.empty()) { + _list.setScrollTopState({ .item = { .fullId = list.ids.front() } }); + } } object_ptr ScheduledMemento::createWidget( @@ -1154,9 +1162,7 @@ Context ScheduledWidget::listContext() { } bool ScheduledWidget::listScrollTo(int top, bool syntetic) { - top = (top == ScrollMax && syntetic) - ? 0 - : std::clamp(top, 0, _scroll->scrollTopMax()); + top = std::clamp(top, 0, _scroll->scrollTopMax()); if (_scroll->scrollTop() == top) { updateInnerVisibleArea(); return false; diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h index 850e56bb7..43702688f 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h @@ -280,7 +280,7 @@ private: }; -class ScheduledMemento : public Window::SectionMemento { +class ScheduledMemento final : public Window::SectionMemento { public: ScheduledMemento(not_null history); ScheduledMemento(not_null forumTopic);