2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00

Jump to near reply inside a replies thread.

This commit is contained in:
John Preston
2020-08-31 15:17:02 +04:00
parent f8b83dd186
commit 1849f01b15
8 changed files with 89 additions and 71 deletions

View File

@@ -1221,10 +1221,6 @@ Image *MainWidget::newBackgroundThumb() {
: nullptr;
}
void MainWidget::pushReplyReturn(not_null<HistoryItem*> item) {
_history->pushReplyReturn(item);
}
void MainWidget::setInnerFocus() {
if (_hider || !_history->peer()) {
if (!_hider && _mainSection) {
@@ -1381,6 +1377,20 @@ void MainWidget::ui_showPeerHistory(
return;
}
}
if (IsServerMsgId(showAtMsgId)
&& _mainSection
&& _mainSection->showMessage(peerId, params, showAtMsgId)) {
return;
}
using OriginMessage = SectionShow::OriginMessage;
if (const auto origin = std::get_if<OriginMessage>(&params.origin)) {
if (const auto returnTo = session().data().message(origin->id)) {
if (returnTo->history()->peer->id == peerId) {
_history->pushReplyReturn(returnTo);
}
}
}
_controller->dialogsListFocused().set(false, true);
_a_dialogsWidth.stop();
@@ -2642,15 +2652,13 @@ void MainWidget::openPeerByName(
}
const auto returnToId = clickFromMessageId;
InvokeQueued(this, [=] {
if (const auto returnTo = session().data().message(returnToId)) {
if (returnTo->history()->peer == peer) {
pushReplyReturn(returnTo);
}
}
_controller->showPeerHistory(
peer->id,
SectionShow::Way::Forward,
msgId);
auto params = SectionShow{
SectionShow::Way::Forward
};
params.origin = SectionShow::OriginMessage{
returnToId
};
_controller->showPeerHistory(peer->id, params, msgId);
});
}
} else {