Search user messages from context menu
This commit is contained in:
parent
7ba072b0dd
commit
2c1153bac9
10 changed files with 30 additions and 10 deletions
|
|
@ -2486,4 +2486,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ktg_stickers_copy_title" = "Copy name";
|
||||
"ktg_stickers_title_copied" = "Sticker pack name copied to clipboard.";
|
||||
|
||||
"ktg_context_show_messages_from" = "User messages";
|
||||
|
||||
// Keys finished
|
||||
|
|
|
|||
|
|
@ -111,5 +111,6 @@
|
|||
"ktg_settings_filters_hide_all": "Скрыть папку «Все чаты»",
|
||||
"ktg_hide_pinned_message": "Скрыть",
|
||||
"ktg_stickers_copy_title": "Копировать название",
|
||||
"ktg_stickers_title_copied": "Название набора стикеров скопировано в буфер обмена."
|
||||
"ktg_stickers_title_copied": "Название набора стикеров скопировано в буфер обмена.",
|
||||
"ktg_context_show_messages_from": "Сообщения пользователя"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1408,6 +1408,9 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
|
|||
result->addAction(
|
||||
tr::lng_context_view_profile(tr::now),
|
||||
crl::guard(this, [=] { _navigation->showPeerInfo(user); }));
|
||||
result->addAction(
|
||||
tr::ktg_context_show_messages_from(tr::now),
|
||||
crl::guard(this, [=] { App::searchByHashtag(QString(), _peer, user); }));
|
||||
if (_role == Role::Kicked) {
|
||||
if (_peer->isMegagroup()
|
||||
&& _additional.canRestrictUser(user)) {
|
||||
|
|
|
|||
|
|
@ -913,7 +913,8 @@ void Widget::showMainMenu() {
|
|||
|
||||
void Widget::searchMessages(
|
||||
const QString &query,
|
||||
Key inChat) {
|
||||
Key inChat,
|
||||
UserData *from) {
|
||||
auto inChatChanged = [&] {
|
||||
if (inChat == _searchInChat) {
|
||||
return false;
|
||||
|
|
@ -929,7 +930,9 @@ void Widget::searchMessages(
|
|||
onCancelSearch();
|
||||
setSearchInChat(inChat);
|
||||
}
|
||||
_filter->setText(query);
|
||||
if (!query.trimmed().isEmpty()) {
|
||||
_filter->setText(query);
|
||||
}
|
||||
_filter->updatePlaceholder();
|
||||
applyFilterUpdate(true);
|
||||
_searchTimer.stop();
|
||||
|
|
@ -937,6 +940,10 @@ void Widget::searchMessages(
|
|||
|
||||
Local::saveRecentSearchHashtags(query);
|
||||
}
|
||||
if (inChat && from) {
|
||||
setSearchInChat(inChat, from);
|
||||
applyFilterUpdate(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::onSearchMore() {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,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 onSearchMore();
|
||||
|
||||
// Float player interface.
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ void activateBotCommand(
|
|||
}
|
||||
}
|
||||
|
||||
void searchByHashtag(const QString &tag, PeerData *inPeer) {
|
||||
void searchByHashtag(const QString &tag, PeerData *inPeer, UserData *from) {
|
||||
if (const auto window = App::wnd()) {
|
||||
if (const auto controller = window->sessionController()) {
|
||||
if (controller->openedFolder().current()) {
|
||||
|
|
@ -172,7 +172,8 @@ void searchByHashtag(const QString &tag, PeerData *inPeer) {
|
|||
tag + ' ',
|
||||
(inPeer && !inPeer->isUser())
|
||||
? inPeer->owner().history(inPeer).get()
|
||||
: Dialogs::Key());
|
||||
: Dialogs::Key(),
|
||||
from);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void activateBotCommand(
|
|||
not_null<const HistoryItem*> msg,
|
||||
int row,
|
||||
int column);
|
||||
void searchByHashtag(const QString &tag, PeerData *inPeer);
|
||||
void searchByHashtag(const QString &tag, PeerData *inPeer, UserData *from = nullptr);
|
||||
void showSettings();
|
||||
|
||||
} // namespace App
|
||||
|
|
|
|||
|
|
@ -1561,6 +1561,12 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
}
|
||||
});
|
||||
}
|
||||
const auto peer = item->history()->peer;
|
||||
if (peer->isChat() || peer->isMegagroup()) {
|
||||
_menu->addAction(tr::ktg_context_show_messages_from(tr::now), [=] {
|
||||
App::searchByHashtag(QString(), peer, item->from()->asUser());
|
||||
});
|
||||
}
|
||||
};
|
||||
const auto addPhotoActions = [&](not_null<PhotoData*> photo) {
|
||||
_menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] {
|
||||
|
|
|
|||
|
|
@ -1026,8 +1026,8 @@ bool MainWidget::insertBotCommand(const QString &cmd) {
|
|||
return _history->insertBotCommand(cmd);
|
||||
}
|
||||
|
||||
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) {
|
||||
_dialogs->searchMessages(query, inChat);
|
||||
void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat, UserData *from) {
|
||||
_dialogs->searchMessages(query, inChat, from);
|
||||
if (Adaptive::OneColumn()) {
|
||||
Ui::showChatsList();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ public:
|
|||
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
||||
bool insertBotCommand(const QString &cmd);
|
||||
|
||||
void searchMessages(const QString &query, Dialogs::Key inChat);
|
||||
void searchMessages(const QString &query, Dialogs::Key inChat, UserData *from = nullptr);
|
||||
void itemEdited(not_null<HistoryItem*> item);
|
||||
|
||||
void checkLastUpdate(bool afterSleep);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue