[Improvement] Allow to search messages from user
This commit is contained in:
parent
9d4402bb0a
commit
ce53c7689b
7 changed files with 49 additions and 7 deletions
|
|
@ -98,6 +98,7 @@
|
|||
"ktg_hide_pinned_message": "Hide",
|
||||
"ktg_stickers_copy_title": "Copy name",
|
||||
"ktg_stickers_title_copied": "Sticker pack name copied to clipboard.",
|
||||
"ktg_context_show_messages_from": "User messages",
|
||||
"ktg_settings_tray_icon": "Tray icon",
|
||||
"ktg_settings_tray_icon_default": "Default",
|
||||
"ktg_settings_tray_icon_blue": "Blue",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "boxes/peers/edit_participants_box.h"
|
||||
|
||||
#include "kotato/kotato_lang.h"
|
||||
#include "core/application.h"
|
||||
#include "api/api_chat_participants.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/peers/edit_participant_box.h"
|
||||
|
|
@ -21,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mtproto/mtproto_config.h"
|
||||
#include "apiwrap.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mainwidget.h"
|
||||
#include "dialogs/dialogs_indexed_list.h"
|
||||
#include "data/data_peer_values.h"
|
||||
|
|
@ -33,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "history/history.h"
|
||||
#include "styles/style_menu_icons.h"
|
||||
|
|
@ -1598,6 +1602,20 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
|||
? &st::menuIconProfile
|
||||
: &st::menuIconInfo));
|
||||
}
|
||||
if (const auto window = _navigation->parentController()) {
|
||||
if (const auto mainwidget = window->widget()->sessionContent()) {
|
||||
result->addAction(
|
||||
ktr("ktg_context_show_messages_from"),
|
||||
crl::guard(this, [=] {
|
||||
mainwidget->searchMessages(
|
||||
" ",
|
||||
(_peer && !_peer->isUser())
|
||||
? _peer->owner().history(_peer).get()
|
||||
: Dialogs::Key(),
|
||||
user);
|
||||
}), &st::menuIconSearch);
|
||||
}
|
||||
}
|
||||
if (_role == Role::Kicked) {
|
||||
if (_peer->isMegagroup()
|
||||
&& _additional.canRestrictParticipant(participant)) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwidget.h"
|
||||
#include "main/main_domain.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_account.h"
|
||||
#include "main/main_session_settings.h"
|
||||
#include "api/api_chat_filters.h"
|
||||
#include "apiwrap.h"
|
||||
|
|
@ -1524,7 +1525,10 @@ void Widget::showMainMenu() {
|
|||
controller()->widget()->showMainMenu();
|
||||
}
|
||||
|
||||
void Widget::searchMessages(const QString &query, Key inChat) {
|
||||
void Widget::searchMessages(
|
||||
const QString &query,
|
||||
Key inChat,
|
||||
UserData *from) {
|
||||
if (_childList) {
|
||||
const auto forum = controller()->shownForum().current();
|
||||
const auto topic = inChat.topic();
|
||||
|
|
@ -1565,13 +1569,19 @@ void Widget::searchMessages(const QString &query, Key inChat) {
|
|||
cancelSearch();
|
||||
setSearchInChat(inChat);
|
||||
}
|
||||
setSearchQuery(query);
|
||||
if (!query.trimmed().isEmpty()) {
|
||||
setSearchQuery(query);
|
||||
}
|
||||
applyFilterUpdate(true);
|
||||
_searchTimer.cancel();
|
||||
searchMessages();
|
||||
|
||||
session().local().saveRecentSearchHashtags(query);
|
||||
}
|
||||
if (inChat && from) {
|
||||
setSearchInChat(inChat, from);
|
||||
applyFilterUpdate(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::searchTopics() {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public:
|
|||
|
||||
void scrollToEntry(const RowDescriptor &entry);
|
||||
|
||||
void searchMessages(const QString &query, Key inChat = {});
|
||||
void searchMessages(const QString &query, Key inChat = {}, UserData *from = nullptr);
|
||||
void searchTopics();
|
||||
void searchMore();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_inner_widget.h"
|
||||
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "kotato/kotato_lang.h"
|
||||
#include "mainwidget.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "core/crash_reports.h"
|
||||
#include "core/click_handler_types.h"
|
||||
|
|
@ -2233,6 +2235,17 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
Window::ToggleMessagePinned(controller, pinItemId, !isPinned);
|
||||
}), isPinned ? &st::menuIconUnpin : &st::menuIconPin);
|
||||
}
|
||||
const auto peer = item->history()->peer;
|
||||
if (peer->isChat() || peer->isMegagroup()) {
|
||||
_menu->addAction(ktr("ktg_context_show_messages_from"), [=] {
|
||||
controller->content()->searchMessages(
|
||||
" ",
|
||||
(peer && !peer->isUser())
|
||||
? peer->owner().history(peer).get()
|
||||
: Dialogs::Key(),
|
||||
item->from()->asUser());
|
||||
}, &st::menuIconSearch);
|
||||
}
|
||||
};
|
||||
const auto addPhotoActions = [&](not_null<PhotoData*> photo, HistoryItem *item) {
|
||||
const auto media = photo->activeMediaView();
|
||||
|
|
|
|||
|
|
@ -751,9 +751,9 @@ void MainWidget::hideSingleUseKeyboard(PeerData *peer, MsgId replyTo) {
|
|||
_history->hideSingleUseKeyboard(peer, replyTo);
|
||||
}
|
||||
|
||||
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
|
||||
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat, UserData *from) {
|
||||
if (controller()->isPrimary()) {
|
||||
_dialogs->searchMessages(query, inChat);
|
||||
_dialogs->searchMessages(query, inChat, from);
|
||||
if (isOneColumn()) {
|
||||
_controller->clearSectionStack();
|
||||
} else {
|
||||
|
|
@ -762,7 +762,7 @@ void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
|
|||
} else {
|
||||
const auto searchIn = [&](not_null<Window::Controller*> window) {
|
||||
if (const auto controller = window->sessionController()) {
|
||||
controller->content()->searchMessages(query, inChat);
|
||||
controller->content()->searchMessages(query, inChat, from);
|
||||
controller->widget()->activate();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ public:
|
|||
void sendBotCommand(Bot::SendCommandRequest request);
|
||||
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
||||
|
||||
void searchMessages(const QString &query, Dialogs::Key inChat);
|
||||
void searchMessages(const QString &query, Dialogs::Key inChat, UserData *from = nullptr);
|
||||
|
||||
void setChatBackground(
|
||||
const Data::WallPaper &background,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue