mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Start chats search rewrite.
This commit is contained in:
@@ -731,8 +731,18 @@ void MainWidget::hideSingleUseKeyboard(FullMsgId replyToId) {
|
||||
}
|
||||
|
||||
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
|
||||
auto tags = Data::SearchTagsFromQuery(query);
|
||||
if (controller()->isPrimary()) {
|
||||
_dialogs->searchMessages(query, inChat);
|
||||
using Tab = Dialogs::ChatSearchTab;
|
||||
auto state = Dialogs::SearchState{
|
||||
.inChat = ((tags.empty() || inChat.sublist())
|
||||
? inChat
|
||||
: session().data().history(session().user())),
|
||||
.tags = tags,
|
||||
.query = tags.empty() ? query : QString(),
|
||||
};
|
||||
state.tab = state.defaultTabForMe();
|
||||
_dialogs->searchMessages(std::move(state));
|
||||
if (isOneColumn()) {
|
||||
_controller->clearSectionStack();
|
||||
} else {
|
||||
@@ -742,7 +752,7 @@ void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
|
||||
if (const auto sublist = inChat.sublist()) {
|
||||
controller()->showSection(
|
||||
std::make_shared<HistoryView::SublistMemento>(sublist));
|
||||
} else if (!Data::SearchTagsFromQuery(query).empty()) {
|
||||
} else if (!tags.empty()) {
|
||||
inChat = controller()->session().data().history(
|
||||
controller()->session().user());
|
||||
}
|
||||
|
Reference in New Issue
Block a user