mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix search from user in forums.
This commit is contained in:
parent
7d61ab9412
commit
b21bcb86cc
1 changed files with 16 additions and 9 deletions
|
@ -1408,6 +1408,9 @@ void Widget::changeOpenedForum(Data::Forum *forum, anim::type animated) {
|
||||||
cancelSearch();
|
cancelSearch();
|
||||||
closeChildList(anim::type::instant);
|
closeChildList(anim::type::instant);
|
||||||
_openedForum = forum;
|
_openedForum = forum;
|
||||||
|
_searchState.tab = forum
|
||||||
|
? ChatSearchTab::ThisPeer
|
||||||
|
: ChatSearchTab::MyMessages;
|
||||||
_api.request(base::take(_topicSearchRequest)).cancel();
|
_api.request(base::take(_topicSearchRequest)).cancel();
|
||||||
_inner->changeOpenedForum(forum);
|
_inner->changeOpenedForum(forum);
|
||||||
storiesToggleExplicitExpand(false);
|
storiesToggleExplicitExpand(false);
|
||||||
|
@ -1468,6 +1471,7 @@ void Widget::refreshTopBars() {
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
_subsectionTopBar.destroy();
|
_subsectionTopBar.destroy();
|
||||||
|
updateSearchFromVisibility(true);
|
||||||
}
|
}
|
||||||
_forumSearchRequested = false;
|
_forumSearchRequested = false;
|
||||||
if (_openedForum) {
|
if (_openedForum) {
|
||||||
|
@ -1542,9 +1546,6 @@ void Widget::showSearchInTopBar(anim::type animated) {
|
||||||
Expects(_subsectionTopBar != nullptr);
|
Expects(_subsectionTopBar != nullptr);
|
||||||
|
|
||||||
_subsectionTopBar->toggleSearch(true, animated);
|
_subsectionTopBar->toggleSearch(true, animated);
|
||||||
_subsectionTopBar->searchEnableChooseFromUser(
|
|
||||||
true,
|
|
||||||
!_searchState.fromPeer);
|
|
||||||
updateForceDisplayWide();
|
updateForceDisplayWide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2888,12 +2889,18 @@ bool Widget::applySearchState(SearchState state) {
|
||||||
if (state.inChat.folder() || (forum && !topic)) {
|
if (state.inChat.folder() || (forum && !topic)) {
|
||||||
state.inChat = {};
|
state.inChat = {};
|
||||||
}
|
}
|
||||||
if (!state.inChat && !forum) {
|
if (!state.inChat && !forum && !_openedForum) {
|
||||||
state.fromPeer = nullptr;
|
state.fromPeer = nullptr;
|
||||||
}
|
}
|
||||||
if (state.tab == ChatSearchTab::PublicPosts
|
if (state.tab == ChatSearchTab::PublicPosts
|
||||||
&& !IsHashtagSearchQuery(state.query)) {
|
&& !IsHashtagSearchQuery(state.query)) {
|
||||||
state.tab = ChatSearchTab::MyMessages;
|
state.tab = (_openedForum && !state.inChat)
|
||||||
|
? ChatSearchTab::ThisPeer
|
||||||
|
: ChatSearchTab::MyMessages;
|
||||||
|
} else if (!state.inChat && !_searchTabs) {
|
||||||
|
state.tab = (forum || _openedForum)
|
||||||
|
? ChatSearchTab::ThisPeer
|
||||||
|
: ChatSearchTab::MyMessages;
|
||||||
}
|
}
|
||||||
if (!state.tags.empty()) {
|
if (!state.tags.empty()) {
|
||||||
state.inChat = session().data().history(session().user());
|
state.inChat = session().data().history(session().user());
|
||||||
|
@ -2913,11 +2920,9 @@ bool Widget::applySearchState(SearchState state) {
|
||||||
|
|
||||||
if (forum) {
|
if (forum) {
|
||||||
if (_openedForum == forum) {
|
if (_openedForum == forum) {
|
||||||
_searchState.fromPeer = state.fromPeer; // showSearchInTopBar
|
|
||||||
showSearchInTopBar(anim::type::normal);
|
showSearchInTopBar(anim::type::normal);
|
||||||
} else if (_layout == Layout::Main) {
|
} else if (_layout == Layout::Main) {
|
||||||
_forumSearchRequested = true;
|
_forumSearchRequested = true;
|
||||||
_searchState.fromPeer = state.fromPeer; // showSearchInTopBar
|
|
||||||
controller()->showForum(forum);
|
controller()->showForum(forum);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -3162,11 +3167,13 @@ void Widget::updateSearchFromVisibility(bool fast) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}();
|
}();
|
||||||
auto changed = (visible == !_chooseFromUser->toggled());
|
const auto changed = (visible == !_chooseFromUser->toggled());
|
||||||
_chooseFromUser->toggle(
|
_chooseFromUser->toggle(
|
||||||
visible,
|
visible,
|
||||||
fast ? anim::type::instant : anim::type::normal);
|
fast ? anim::type::instant : anim::type::normal);
|
||||||
if (changed) {
|
if (_subsectionTopBar) {
|
||||||
|
_subsectionTopBar->searchEnableChooseFromUser(true, visible);
|
||||||
|
} else if (changed) {
|
||||||
auto additional = QMargins();
|
auto additional = QMargins();
|
||||||
if (visible) {
|
if (visible) {
|
||||||
additional.setRight(_chooseFromUser->width());
|
additional.setRight(_chooseFromUser->width());
|
||||||
|
|
Loading…
Add table
Reference in a new issue