mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-25 15:03:03 +02:00
Fix some search options.
This commit is contained in:
parent
154c777788
commit
77a09a0e59
4 changed files with 25 additions and 9 deletions
|
@ -3069,6 +3069,11 @@ void InnerWidget::clearSelection() {
|
|||
}
|
||||
|
||||
void InnerWidget::fillSupportSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
||||
const auto globalSearch = (_searchState.tab == ChatSearchTab::MyMessages)
|
||||
|| (_searchState.tab == ChatSearchTab::PublicPosts);
|
||||
if (!globalSearch && _searchState.inChat) {
|
||||
return;
|
||||
}
|
||||
const auto all = session().settings().supportAllSearchResults();
|
||||
const auto text = all ? "Only one from chat" : "Show all messages";
|
||||
menu->addAction(text, [=] {
|
||||
|
@ -3079,9 +3084,11 @@ void InnerWidget::fillSupportSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
|||
|
||||
void InnerWidget::fillArchiveSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
||||
const auto folder = session().data().folderLoaded(Data::Folder::kId);
|
||||
const auto globalSearch = (_searchState.tab == ChatSearchTab::MyMessages)
|
||||
|| (_searchState.tab == ChatSearchTab::PublicPosts);
|
||||
if (!folder
|
||||
|| !folder->chatsList()->fullSize().current()
|
||||
|| _searchState.inChat) {
|
||||
|| (!globalSearch && _searchState.inChat)) {
|
||||
return;
|
||||
}
|
||||
const auto skip = session().settings().skipArchiveInSearch();
|
||||
|
@ -3796,7 +3803,7 @@ void InnerWidget::itemRemoved(not_null<const HistoryItem*> item) {
|
|||
}
|
||||
|
||||
bool InnerWidget::uniqueSearchResults() const {
|
||||
return _controller->uniqueChatsInSearchResults();
|
||||
return _controller->uniqueChatsInSearchResults(_searchState);
|
||||
}
|
||||
|
||||
bool InnerWidget::hasHistoryInResults(not_null<History*> history) const {
|
||||
|
@ -3854,7 +3861,8 @@ void InnerWidget::searchReceived(
|
|||
? _searchState.inChat
|
||||
: Key(_openedForum->history());
|
||||
if (inject
|
||||
&& (!_searchState.inChat
|
||||
&& (globalSearch
|
||||
|| !_searchState.inChat
|
||||
|| inject->history() == _searchState.inChat.history())) {
|
||||
Assert(_searchResults.empty());
|
||||
Assert(!toPreview);
|
||||
|
|
|
@ -967,9 +967,9 @@ void Widget::chosenRow(const ChosenRow &row) {
|
|||
return;
|
||||
} else if (history) {
|
||||
const auto peer = history->peer;
|
||||
const auto showAtMsgId = controller()->uniqueChatsInSearchResults()
|
||||
? ShowAtUnreadMsgId
|
||||
: row.message.fullId.msg;
|
||||
const auto showAtMsgId = controller()->uniqueChatsInSearchResults(
|
||||
_searchState
|
||||
) ? ShowAtUnreadMsgId : row.message.fullId.msg;
|
||||
auto params = Window::SectionShow(
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
params.highlightPart.text = _searchState.query;
|
||||
|
|
|
@ -53,6 +53,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_peer_values.h"
|
||||
#include "data/data_premium_limits.h"
|
||||
#include "data/data_web_page.h"
|
||||
#include "dialogs/ui/chat_search_in.h"
|
||||
#include "passport/passport_form_controller.h"
|
||||
#include "chat_helpers/tabbed_selector.h"
|
||||
#include "chat_helpers/emoji_interactions.h"
|
||||
|
@ -1803,10 +1804,13 @@ void SessionController::activateFirstChatsFilter() {
|
|||
setActiveChatsFilter(session().data().chatsFilters().defaultId());
|
||||
}
|
||||
|
||||
bool SessionController::uniqueChatsInSearchResults() const {
|
||||
bool SessionController::uniqueChatsInSearchResults(
|
||||
const Dialogs::SearchState &state) const {
|
||||
const auto global = (state.tab == Dialogs::ChatSearchTab::MyMessages)
|
||||
|| (state.tab == Dialogs::ChatSearchTab::PublicPosts);
|
||||
return session().supportMode()
|
||||
&& !session().settings().supportAllSearchResults()
|
||||
&& !_searchInChat.current();
|
||||
&& (global || !state.inChat);
|
||||
}
|
||||
|
||||
bool SessionController::openFolderInDifferentWindow(
|
||||
|
|
|
@ -30,6 +30,10 @@ class SavedMessages;
|
|||
enum class StorySourcesList : uchar;
|
||||
} // namespace Data
|
||||
|
||||
namespace Dialogs {
|
||||
struct SearchState;
|
||||
} // namespace Dialogs
|
||||
|
||||
namespace ChatHelpers {
|
||||
class TabbedSelector;
|
||||
class EmojiInteractions;
|
||||
|
@ -404,7 +408,7 @@ public:
|
|||
void setSearchInChat(Dialogs::Key value) {
|
||||
_searchInChat = value;
|
||||
}
|
||||
bool uniqueChatsInSearchResults() const;
|
||||
bool uniqueChatsInSearchResults(const Dialogs::SearchState &state) const;
|
||||
|
||||
void openFolder(not_null<Data::Folder*> folder);
|
||||
void closeFolder();
|
||||
|
|
Loading…
Add table
Reference in a new issue