diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 29c01c8d80..4789cdf783 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -2348,6 +2348,13 @@ QString BotKeyboard::tooltipText() const { return QString(); } +void BotKeyboard::onParentScrolled() { + // Holding scrollarea can fire scrolled() event from a resize() call before + // the resizeEvent() is called, which prepares _impl for updateSelected() call. + // Calling updateSelecteD() without delay causes _impl->getState() before _impl->resize(). + QMetaObject::invokeMethod(this, "updateSelected", Qt::QueuedConnection); +} + void BotKeyboard::updateSelected() { PopupTooltip::Show(1000, this); @@ -2810,7 +2817,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) _kbScroll.setWidget(&_keyboard); _kbScroll.hide(); - connect(&_kbScroll, SIGNAL(scrolled()), &_keyboard, SLOT(updateSelected())); + connect(&_kbScroll, SIGNAL(scrolled()), &_keyboard, SLOT(onParentScrolled())); updateScrollColors(); diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 7340a8f16a..8e74a03572 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -347,6 +347,10 @@ public: public slots: + void onParentScrolled(); + +private slots: + void updateSelected(); private: diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 026d063b9a..78cd7023c8 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -3734,6 +3734,9 @@ void MainWidget::usernameResolveDone(QPair msgIdAndStartToken, c if (peer->isUser() && peer->asUser()->botInfo && !peer->asUser()->botInfo->cantJoinGroups && !startToken.isEmpty()) { peer->asUser()->botInfo->startGroupToken = startToken; Ui::showLayer(new ContactsBox(peer->asUser())); + } else if (peer->isUser() && peer->asUser()->botInfo) { + // Always open bot chats, even from mention links. + Ui::showPeerHistoryAsync(peer->id, ShowAtUnreadMsgId); } else { showPeerProfile(peer); }