mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix search by a hashtag from a topic.
This commit is contained in:
parent
98af2d3006
commit
7cf3babcbd
4 changed files with 28 additions and 2 deletions
|
@ -1466,6 +1466,16 @@ void Widget::showMainMenu() {
|
|||
void Widget::searchMessages(
|
||||
const QString &query,
|
||||
Key inChat) {
|
||||
if (_childList) {
|
||||
const auto forum = controller()->shownForum().current();
|
||||
const auto topic = inChat.topic();
|
||||
if ((forum && forum->channel() == inChat.peer())
|
||||
|| (topic && topic->forum() == forum)) {
|
||||
_childList->searchMessages(query, inChat);
|
||||
return;
|
||||
}
|
||||
hideChildList();
|
||||
}
|
||||
const auto inChatChanged = [&] {
|
||||
const auto inPeer = inChat.peer();
|
||||
const auto inTopic = inChat.topic();
|
||||
|
@ -1482,12 +1492,12 @@ void Widget::searchMessages(
|
|||
}
|
||||
return true;
|
||||
}();
|
||||
if ((_filter->getLastText() != query) || inChatChanged) {
|
||||
if ((currentSearchQuery() != query) || inChatChanged) {
|
||||
if (inChat) {
|
||||
cancelSearch();
|
||||
setSearchInChat(inChat);
|
||||
}
|
||||
_filter->setText(query);
|
||||
setSearchQuery(query);
|
||||
applyFilterUpdate(true);
|
||||
_searchTimer.cancel();
|
||||
searchMessages();
|
||||
|
@ -2570,6 +2580,14 @@ void Widget::clearSearchField() {
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::setSearchQuery(const QString &query) {
|
||||
if (_subsectionTopBar) {
|
||||
_subsectionTopBar->searchSetText(query);
|
||||
} else {
|
||||
_filter->setText(query);
|
||||
}
|
||||
}
|
||||
|
||||
bool Widget::cancelSearch() {
|
||||
auto clearingQuery = !currentSearchQuery().isEmpty();
|
||||
auto clearingInChat = false;
|
||||
|
|
|
@ -166,6 +166,7 @@ private:
|
|||
void showSearchFrom();
|
||||
void showMainMenu();
|
||||
void clearSearchCache();
|
||||
void setSearchQuery(const QString &query);
|
||||
void updateControlsVisibility(bool fast = false);
|
||||
void updateLockUnlockVisibility();
|
||||
void updateLoadMoreChatsVisibility();
|
||||
|
|
|
@ -1344,6 +1344,12 @@ void TopBarWidget::searchClear() {
|
|||
}
|
||||
}
|
||||
|
||||
void TopBarWidget::searchSetText(const QString &query) {
|
||||
if (_searchMode) {
|
||||
_searchField->setText(query);
|
||||
}
|
||||
}
|
||||
|
||||
void TopBarWidget::toggleSelectedControls(bool shown) {
|
||||
_selectedShown.start(
|
||||
[this] { slideAnimationCallback(); },
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
[[nodiscard]] rpl::producer<QString> searchQuery() const;
|
||||
[[nodiscard]] QString searchQueryCurrent() const;
|
||||
void searchClear();
|
||||
void searchSetText(const QString &query);
|
||||
|
||||
[[nodiscard]] rpl::producer<> forwardSelectionRequest() const {
|
||||
return _forwardSelection.events();
|
||||
|
|
Loading…
Add table
Reference in a new issue