Removed Ui::showPeerProfile.

This commit is contained in:
23rd 2022-06-08 16:00:11 +03:00
parent 58163ea581
commit cc7a4c2772
4 changed files with 13 additions and 32 deletions

View file

@ -30,6 +30,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
// Possible context owners: media viewer, profile, history widget.
void SearchByHashtag(ClickContext context, const QString &tag) {
const auto my = context.other.value<ClickHandlerContext>();
const auto controller = my.sessionWindow.get();
@ -172,9 +174,10 @@ QString MentionClickHandler::copyToClipboardContextItemText() const {
void MentionClickHandler::onClick(ClickContext context) const {
const auto button = context.button;
if (button == Qt::LeftButton || button == Qt::MiddleButton) {
if (const auto m = App::main()) { // multi good
const auto my = context.other.value<ClickHandlerContext>();
if (const auto controller = my.sessionWindow.get()) {
using Info = Window::SessionNavigation::PeerByLinkInfo;
m->controller()->showPeerByLink(Info{
controller->showPeerByLink(Info{
.usernameOrId = _tag.mid(1),
.resolveType = Window::ResolveType::Mention,
});
@ -189,8 +192,11 @@ auto MentionClickHandler::getTextEntity() const -> TextEntity {
void MentionNameClickHandler::onClick(ClickContext context) const {
const auto button = context.button;
if (button == Qt::LeftButton || button == Qt::MiddleButton) {
if (auto user = _session->data().userLoaded(_userId)) {
Ui::showPeerProfile(user);
const auto my = context.other.value<ClickHandlerContext>();
if (const auto controller = my.sessionWindow.get()) {
if (auto user = _session->data().userLoaded(_userId)) {
controller->showPeerInfo(user);
}
}
}
}

View file

@ -251,29 +251,6 @@ void activateBotCommand(
namespace Ui {
void showPeerProfile(not_null<PeerData*> peer) {
if (const auto window = App::wnd()) { // multi good
if (const auto controller = window->sessionController()) {
if (&controller->session() == &peer->session()) {
controller->showPeerInfo(peer);
return;
}
}
if (&Core::App().domain().active() != &peer->session().account()) {
Core::App().domain().activate(&peer->session().account());
}
if (const auto controller = window->sessionController()) {
if (&controller->session() == &peer->session()) {
controller->showPeerInfo(peer);
}
}
}
}
void showPeerProfile(not_null<const History*> history) {
showPeerProfile(history->peer);
}
void showChatsList(not_null<Main::Session*> session) {
if (const auto m = CheckMainWidget(session)) {
m->ui_showPeerHistory(

View file

@ -47,9 +47,6 @@ namespace Ui {
// Legacy global methods.
void showPeerProfile(not_null<PeerData*> peer);
void showPeerProfile(not_null<const History*> history);
void showPeerHistory(not_null<const PeerData*> peer, MsgId msgId);
void showPeerHistory(not_null<const History*> history, MsgId msgId);
void showChatsList(not_null<Main::Session*> session);

View file

@ -79,7 +79,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/file_download.h"
#include "storage/storage_account.h"
#include "calls/calls_instance.h"
#include "facades.h"
#include "styles/style_media_view.h"
#include "styles/style_chat.h"
#include "styles/style_menu_icons.h"
@ -4482,7 +4481,9 @@ void OverlayWidget::handleMouseRelease(
if (_over == OverName && _down == OverName) {
if (_from) {
close();
Ui::showPeerProfile(_from);
if (const auto window = findWindow(true)) {
window->showPeerInfo(_from);
}
}
} else if (_over == OverDate && _down == OverDate) {
toMessage();