mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fixed behavior to open section with scheduled messages at top.
This commit is contained in:
parent
84ce72ec7a
commit
94f1d23788
2 changed files with 10 additions and 4 deletions
|
@ -58,11 +58,19 @@ namespace HistoryView {
|
|||
ScheduledMemento::ScheduledMemento(not_null<History*> 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<Data::ForumTopic*> 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<Window::SectionWidget> 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;
|
||||
|
|
|
@ -280,7 +280,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class ScheduledMemento : public Window::SectionMemento {
|
||||
class ScheduledMemento final : public Window::SectionMemento {
|
||||
public:
|
||||
ScheduledMemento(not_null<History*> history);
|
||||
ScheduledMemento(not_null<Data::ForumTopic*> forumTopic);
|
||||
|
|
Loading…
Add table
Reference in a new issue