2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 23:45:44 +00:00

Implement basic recent search results.

This commit is contained in:
John Preston
2024-04-12 12:25:37 +04:00
parent 2e0529bd9a
commit 2a6ff9203b
14 changed files with 456 additions and 57 deletions

View File

@@ -58,6 +58,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/storage_media_prepare.h"
#include "storage/storage_account.h"
#include "storage/storage_domain.h"
#include "data/components/recent_peers.h"
#include "data/data_session.h"
#include "data/data_channel.h"
#include "data/data_chat.h"
@@ -514,6 +515,12 @@ Widget::Widget(
void Widget::chosenRow(const ChosenRow &row) {
storiesToggleExplicitExpand(false);
if (!_search->getLastText().isEmpty()) {
if (const auto history = row.key.history()) {
session().recentPeers().bump(history->peer);
}
}
const auto history = row.key.history();
const auto topicJump = history
? history->peer->forumTopicFor(row.message.fullId.msg)
@@ -1120,11 +1127,13 @@ void Widget::updateSuggestions(anim::type animated) {
_suggestions = std::make_unique<Suggestions>(
this,
controller(),
TopPeersContent(&session()));
TopPeersContent(&session()),
RecentPeersContent(&session()));
_suggestions->topPeerChosen(
) | rpl::start_with_next([=](PeerId id) {
const auto peer = session().data().peer(id);
rpl::merge(
_suggestions->topPeerChosen(),
_suggestions->recentPeerChosen()
) | rpl::start_with_next([=](not_null<PeerData*> peer) {
if (base::IsCtrlPressed()) {
controller()->showInNewWindow(peer);
} else {