2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 07:25:46 +00:00

Support forwarding to monoforums.

This commit is contained in:
John Preston
2025-05-13 18:18:24 +04:00
parent e17bf18350
commit 76db55ff19
36 changed files with 516 additions and 78 deletions

View File

@@ -644,6 +644,17 @@ bool MainWidget::filesOrForwardDrop(
clearHider(_hider);
}
return true;
} else if (const auto history = thread->asHistory()
; history && history->peer->monoforum()) {
Window::ShowDropMediaBox(
_controller,
Core::ShareMimeMediaData(data),
history->peer->monoforum());
if (_hider) {
_hider->startHide();
clearHider(_hider);
}
return true;
}
if (data->hasFormat(u"application/x-td-forward"_q)) {
auto draft = Data::ForwardDraft{
@@ -780,7 +791,7 @@ void MainWidget::searchMessages(
using namespace HistoryView;
controller()->showSection(
std::make_shared<ChatMemento>(ChatViewId{
.history = sublist->parentHistory(),
.history = sublist->owningHistory(),
.sublist = sublist,
}));
} else if (!tags.empty()) {
@@ -1548,6 +1559,12 @@ void MainWidget::showMessage(
if (params.activation != anim::activation::background) {
_controller->window().activate();
}
} else if (const auto sublist = item->savedSublist()
; sublist && sublist->parentChat()) {
_controller->showSublist(sublist, item->id, params);
if (params.activation != anim::activation::background) {
_controller->window().activate();
}
} else {
// showPeerHistory may be redirected to different window,
// so we don't call activate() on current controller's window.
@@ -2621,10 +2638,10 @@ auto MainWidget::thirdSectionForCurrentMainSection(
return std::make_shared<Info::Memento>(
peer,
Info::Memento::DefaultSection(peer));
} else if (key.sublist()) {
} else if (const auto sublist = key.sublist()) {
return std::make_shared<Info::Memento>(
session().user(),
Info::Memento::DefaultSection(session().user()));
sublist->owningHistory()->peer,
Info::Memento::DefaultSection(sublist->owningHistory()->peer));
}
Unexpected("Key in MainWidget::thirdSectionForCurrentMainSection().");
}