Show loading state for non-loaded forum topics list.

This commit is contained in:
John Preston 2022-11-29 18:18:05 +04:00
parent 03b35457fa
commit 623176e901
3 changed files with 11 additions and 4 deletions

View file

@ -4036,6 +4036,9 @@ void Session::refreshChatListEntry(Dialogs::Key key) {
removeChatListEntry(migrated); removeChatListEntry(migrated);
} }
} }
if (const auto forum = history->peer->forum()) {
forum->preloadTopics();
}
} }
} }

View file

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_forum.h" #include "data/data_forum.h"
#include "data/data_forum_topic.h" #include "data/data_forum_topic.h"
#include "core/ui_integration.h" #include "core/ui_integration.h"
#include "lang/lang_keys.h"
#include "ui/painter.h" #include "ui/painter.h"
#include "ui/text/text_options.h" #include "ui/text/text_options.h"
#include "ui/text/text_utilities.h" #include "ui/text/text_utilities.h"
@ -119,6 +120,13 @@ void TopicsView::paint(
: st::dialogsTextPaletteArchive); : st::dialogsTextPaletteArchive);
auto rect = geometry; auto rect = geometry;
auto skipBig = _jumpToTopic && !context.active; auto skipBig = _jumpToTopic && !context.active;
if (_titles.empty()) {
p.drawText(
rect.x(),
rect.y() + st::normalFont->ascent,
tr::lng_contacts_loading(tr::now));
return;
}
for (const auto &title : _titles) { for (const auto &title : _titles) {
if (rect.width() < title.title.style()->font->elidew) { if (rect.width() < title.title.style()->font->elidew) {
break; break;

View file

@ -2762,10 +2762,6 @@ void History::applyDialog(
draft->c_draftMessage()); draft->c_draftMessage());
} }
owner().histories().dialogEntryApplied(this); owner().histories().dialogEntryApplied(this);
if (const auto forum = inChatList() ? peer->forum() : nullptr) {
forum->preloadTopics();
}
} }
void History::dialogEntryApplied() { void History::dialogEntryApplied() {